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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

invoking from vba the file open dialogue box to get path 1

Status
Not open for further replies.

electricpete

Technical User
Oct 1, 2002
289
US
I have powerpoint 2000.

I would like to be able to launch a file open dialogue box which would allow user to navigate to a file or directory so I can determine the path name. (easier than asking the user to type out a long path name).

I checked the FAQ. I saw faq707-4114 describing how to "Open File(s) using the GetOpenFilename dialog"

That sounds like exactly what I need. Application.GetOpenFilename doesn't exist for me (doesn't come up as part of the dropdown menu after application.____)

I'm not sure whether this is part of a later version of powerpoint? Or do I need to add some reference to have access to this? Or some other way to accomplish my goal?

Thanks in advance.
 
By the way, the application here is powerpoint. (I should have mentioned that in my subject line)
 
Hi electricpete,

Unless you have some particular reason for wanting to use the File|Open dialogue box, I'd suggest using the 'Browse for Folder' approach. For example:
Code:
Sub GetFolder()
Dim strRoot As String
Dim strBrowsedPath As String
strRoot = "C:\"
strBrowsedPath = CreateObject("Shell.Application").BrowseForFolder(0, _
"Select a Folder", 0, (strRoot)).Items.Item.Path
MsgBox strBrowsedPath
End Sub
The selected folder is returned via the variable strBrowsedPath.

With this code, you also specify the root folder for the search - or you could use the current file path or application path. All this is done via the strRoot variable.

Cheers

[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top