I am trying to make a macro to open up the directory so i can access and choose any file by just a click of a button. So i click the button, and i need it to open up the directory, and i need to be able to choose the file from there (this is not a specific file...just any file).
Thanks!
Update:Ok, so i made it a dialog box. Here is the code that i have.
Private Sub CommandButton1_Click()
Application.Dialogs.Item(xlDialogOpen).Show Arg3:=True
End Sub
The problem is that it opens as a read only. Also, i need to get the path of the file on a textbox. So i have to click this button, choose a file (and it can't be read only), and when i say open, its path should show up in the textbox. Then i need to click ANOTHER button, where it takes all the information from the file i just 'opened' and do stuff to it (that issue i know how to deal with).
Thank you for your help! I am a new user to VBA and so this is rather tough for me. Thank you!
Copyright © 2024 EBIN.TIPS - All rights reserved.
Answers & Comments
Verified answer
You should use the common file dialog to make your life a lot easier. It is well documented in the MSDN at http://msdn.microsoft.com/en-us/library/aa163948(o...
I am confused ... this seems exactly what "Microsoft Common Dialog" does. Do you need some extra features? Or with "dir" function you can get the file list and then, list them in a listbox.