Browsing For Files

D

DavidW

I have added the following code to my form to open a browse dialog:

Dim oShell
Dim oFolder
Dim oFolderItem
Dim strFilePath

Set oShell = CreateObject("Shell.Application")
Set oFolder = oShell.BrowseForFolder(0,"OpenFile",&H4000+&H0200)
If not isnull(oFolder.Items.Item) then
Set oFolderItem = oFolder.Items.Item
End If

This code opens a browse dialog but if I select a file it returns nothing
but will return the path of a folder if I select it. What I want to be able
to do is generate the full path to a file including the filename. Can anyone
tell me how to do this please?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

According to the MSDN documentation on that method it only returns a folder,
not a file. You might try something like FindFiles.
 

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