Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Folder for Dialog Box

Status
Not open for further replies.

alexbel

Technical User
Joined
Jun 27, 2004
Messages
77
Location
US
Hi,

I was wondering how I can specify the default folder of a dialog box. The dialog box is a function.

Thank you
 
A function like this ?
Function PickFolder(strStartDir) As String
Dim SA As Object, F As Object
Set SA = CreateObject("Shell.Application")
Set F = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)
If (Not F Is Nothing) Then
PickFolder = F.Items.Item.Path
End If
Set F = Nothing
Set SA = Nothing
End Function

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Here's the code that I currently have:

Code:
   Dim strFileName As String
       Dim oDialog As Object
       Set oDialog = [Forms]![frmForm1]!xDialog.Object
       With oDialog   ' Ask for new file location.
         .DialogTitle = "Please select a new file"
         .Filter = "Access Database(*.mdb)|" & _
         "*.mdb"
        
         .FilterIndex = 1
         .ShowOpen
         ' If user responded, put selection into text box on form.
         If Len(.FileName) > 0 Then _
         [Forms]![frmForm1]![txtFileName] = .FileName
       End With

Would I put:

Code:
 Set F = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)

In my code?

Thank you
 
NO, forgive me. I misunderstood your post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top