Getting File and Path data

R

Ray Batig

Greetings,

The following code is part of an Excel macro which pops up the familiar file
open data sheet. Apparently Visio VB doesn't use this method. This allows
the user to drill down to the right folder which contains the file, and then
lets VB capture the path and file. How would you do this in Visio VB?

Thanks in advance for your help!

Ray

' Store the Excel file path since the GetOpenFilename will reset the
current path
Dim CurrentDir As Variant
CurrentDir = CurDir()
' Go look and point - Note you start in the Excel Files home
directory -
Dim fNameAndPath As Variant
If fNameAndPath <> False Then Reset
fNameAndPath = ""
fNameAndPath = Application.GetOpenFilename(Filefilter:="Excel Files
(*.xls), *.xls", _
Title:="Highlight File To Be Opened")

If fNameAndPath = False Then

MsgBox (" No File Selected! ")

Else

MsgBox "Selected file is:" & fNameAndPath

End If
Reset:
' Reset the CurrentDirectory to the Excel File home
 
J

JuneTheSecond

DoCmd method might be a way, like
Application.DoCmd visCmdFileOpen
DoCmd method does not return the result.
If you cancel dialog, an error message might appear.
You might neglect error using error trap.
 
J

JuneTheSecond

Or you might use Visual Studio Express, it is free software, it includes a
set of file dialogs
 

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