Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Retrieve Access database Path and File name

'/=====================================/
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative path to Access database Richard Excel Discussion (Misc queries) 2 April 7th 08 03:14 PM
Path/File Access Error Geetha[_2_] Excel Programming 1 August 16th 06 08:59 AM
select database file path location for excel query GerryE Excel Programming 3 July 12th 06 01:23 AM
macro to retrieve path to opened file windsurferLA Excel Programming 3 February 17th 05 10:05 PM
Path/File Access Error Ajit[_3_] Excel Programming 3 April 15th 04 06:40 PM


All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"