Setting Directory before Browsing (Allen Browne)

G

GeorgieGirl

Allen,

In a reply to rc5wv on 12/12/05 you stated that using the browsing solution
at http://www.mvps.org/access/api/api0001.htm you can specify the initial
directory.

I am using this function to browse and would like to set the initial
directory. Could you please tell me how and where to place this in the code.
I am not a programmer so I would appreciate it if you could be very specific.

Thank you for any help.
 
A

Allen Browne

Assuming you already have the code from that link in a standard module, you
can call it by creating a function like the example below.

The example tells the dialog to use C:\ as the initial directory, sets the
title, and specifies the type of file the user can choose. It returns the
fully qualified file name, or a zero-length string if the user cancels the
dialog.

Function PickTheFile() As String
Dim msaof As MSA_OPENFILENAME

msaof.strInitialDir = "C:\"
msaof.strDialogTitle = "Choose a file"
msaof.strFilter = MSA_CreateFilterString("Databases", "*.mdb")

Call MSA_GetOpenFileName(msaof) ' Call the Open dialog routine.
PickTheFile = Trim(msaof.strFullPathReturned)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top