Help implementing "Browse" for filename

newone

Registered User.
Local time
Today, 08:32
Joined
Mar 8, 2001
Messages
15
I am TOTALLY new to VBA. I need help trying to add a browse type function from within a macro (any suggestions on a better way of accomplishing this are welcomed.) I have a macro that imports a text file using TransferText and the file to be imported is hardcoded. I need the user to have the ability to browse for the file instead of typing the path and name.

I have looked through the forum and noticed that it has been mentioned a couple of times to use "Common Dialog" control of ActiveX. I don't have a clue about how to go about that. If anyone can offer help to get me started, I would greatly appreciate. OR if there is a better way to do this, I would welcome your suggestions also.
 
Get Litwin's Access 97 Developer's Handbook. See Chapter 19, page 1143 for a listing of the code to generate the common dialog and how to use it. The book has a CD included which also has the code. It's all legally reusable.
 
Thanks to both who replied.

I managed to get this to work like I want after I found some code here -> http://www.mvps.org/access/api/api0001.htm
that I copied into a module and then was able to modify to fit my needs.

To figure all of this out I first converted my macro for transfertext to a module. I then took that code and inserted it into the module that I had pasted the above example into. After much studying, I finally determined how to pass the file name that came from the user's selection to the transfertext function. I then had my macro run the function that I added to the code instead of running the transfertext, as I had originally been doing. Everything works great.

If anyone is in the same predicament that I was in and has no experience how to accomplish this, I'll be glad to share with you what I did if you will email me.
 

Users who are viewing this thread

Back
Top Bottom