Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File Path Control

How to put a File path control in VBA front panel? I want the user to be able to select the browse button and select the file path rather than putting up dialog boxes all over the place. I need the user to select three or more file paths.

like image 955
Manoj Avatar asked Mar 01 '23 05:03

Manoj


1 Answers

After re-re-reading your Q, it seams you want to steer away from dialog boxes!Oh well, I was going to say

I could post the hack about using MSDIAG on VBA, that explains how you can patch your registry to enable its use under VBA, without having other MS-VB products installed... but I rather have you google that one... you can certainly understand why.

But you don't want Dialog Boxes... you want controls and buttons: Use listboxes! To populate your listbox, use the Dir command (using method additem of the listbox). Two phases for achieving that:

  • first get the Directories (and prefix a "->" or whatever prior to adding it on the listbox, so that the user understands this is not a file);
  • then get filenames (you can filter by extension with the arguments of Dir, just as you would in DOS).

Finally, under OnClick and OnDoubleClick of the listbox, you must interpret the listbox default property (Item), check for "->" and use ChDir to change directory and repopulate, or you'll have your file selected.

The write up is sooooooo much more complicated than the code... trust me.

like image 129
jpinto3912 Avatar answered Mar 15 '23 09:03

jpinto3912