Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retrieve Access database Path and File name
Is there a way to navigate to and select a folder using a similar method, but
without having to pick a file within that folder? I'd like my users to be able to navigate to a desired folder where a standard set of files is located. The folder path would be returned as a string and used to navigat to that standard file set in future operations. Thanks! "Charles Chickering" wrote: Using the File dialogs does not open the files for you, it just give you a UI for the user to pick the file from. After the file is selected you can do what you want. Sub TestOpen() Dim f1 As String With Application.FileDialog(msoFileDialogOpen) .AllowMultiSelect = False .InitialFileName = "C:\YourDefaultFolder" .Filters.Clear .Filters.Add "Database Files", "*.mdb" .FilterIndex = 1 If .Show = False Then Exit Sub f1 = .SelectedItems(1) End With MsgBox "User Selected " & f1 End Sub -- Charles Chickering "A good example is twice the value of good advice." "JT" wrote: I have a macro that I want the user to select an Access database. I don't want the macro / user to open it with a dialog box. I would like them to use something like a dialog box to navigate and select the item. Once it is selected, my macro will strip of the file name and path where it is located. Any suggestions or code to accomplish this? Thanks for the help..... -- JT |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retrieve Access database Path and File name
perfect! this is exactly what I was looking for. Thank you :)
"Gary Brown" wrote: '/=====================================/ Sub TestOpen() Dim f1 As String With Application.FileDialog(msoFileDialogFolderPicker) If .Show = False Then Exit Sub f1 = .SelectedItems(1) End With MsgBox "User Selected " & f1 End Sub '/=====================================/ -- HTH, Gary Brown If this post was helpful to you, please select ''YES'' at the bottom of the post. "tenlbham" wrote: Is there a way to navigate to and select a folder using a similar method, but without having to pick a file within that folder? I'd like my users to be able to navigate to a desired folder where a standard set of files is located. The folder path would be returned as a string and used to navigat to that standard file set in future operations. Thanks! "Charles Chickering" wrote: Using the File dialogs does not open the files for you, it just give you a UI for the user to pick the file from. After the file is selected you can do what you want. Sub TestOpen() Dim f1 As String With Application.FileDialog(msoFileDialogOpen) .AllowMultiSelect = False .InitialFileName = "C:\YourDefaultFolder" .Filters.Clear .Filters.Add "Database Files", "*.mdb" .FilterIndex = 1 If .Show = False Then Exit Sub f1 = .SelectedItems(1) End With MsgBox "User Selected " & f1 End Sub -- Charles Chickering "A good example is twice the value of good advice." "JT" wrote: I have a macro that I want the user to select an Access database. I don't want the macro / user to open it with a dialog box. I would like them to use something like a dialog box to navigate and select the item. Once it is selected, my macro will strip of the file name and path where it is located. Any suggestions or code to accomplish this? Thanks for the help..... -- JT |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Relative path to Access database | Excel Discussion (Misc queries) | |||
Path/File Access Error | Excel Programming | |||
select database file path location for excel query | Excel Programming | |||
macro to retrieve path to opened file | Excel Programming | |||
Path/File Access Error | Excel Programming |