VBA macro "Browse" button

Hello

I would like to put a "Browse" button (which opens a window to browse folders and files) in a UserForm (VBA). Is this possible? If so, how?

(Win 7 64-bit, SW2013)

 

Thank you!

see this link I think the answer is in it ;-)

http://www.developpez.net/forums/d148453/logiciels/microsoft-office/excel/macros-vba-excel/vba-e-bouton-parcourir-selectionner-fichier/

1 Like

Hello

Let's see if the function for Excel also works for SolidWorks:

http://www.lynkoa.com/tutos/3d/selectionner-un-repertoire-en-vba

If not, I'll look in more detail.

Edit: for SolidWorks, see here:

https://forum.solidworks.com/thread/25843

 

1 Like

Hello

Thank you for your answers.

I looked at your .PL tutorial, but the "FileDialog" function doesn't exist on SW.

 

And looking at your other links, I'm getting quite a bit of an error. (Despite the PtrSafe since I'm in 64 bits) (Especially because this type "Dim ObjectFound As FileSearch" is not known in SW)

Hello

There is the GetOpenFileName function that allows you to have the folder browsing interface.

Attached are two examples with different interafces.

 


interfaces_explorateur_dossier.txt
4 Likes

Indeed, I tested it quickly and it seems to meet my expectations. I'll keep you posted! Thank you!

1 Like

Hello

 

Thank you liryc for your code which also allowed me to solve my problem on macros created in 32 bits.

On the other hand, with this code we lose a little functionality, it is no longer possible to copy-paste a path, which was very practical with the old code 32.

 

Do you have a trick to remedy this?

1 Like