Dialog Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using the following code to try and get back a path and filename that the user has browsed to, but cannit get the path. Can anyone help
Thank

Sub GetFilePath(
Dim sFilename As Strin
Dim sFilePath As Strin
Dim dlgSaveAs As Dialo

Set dlgSaveAs = Dialogs(wdDialogFileOpen
dlgSaveAs.Displa
sFilename = dlgSaveAs.Nam
sFilePath = dlgSaveAs.???
MsgBox sFilePath & "\" & sFilenam

End Sub
 
Hi =?Utf-8?B?cGViYmxlcw==?=,
I'm using the following code to try and get back a path and filename that the user has browsed to, but cannit get the path.
Try this. Note the changes I've made to allow for how the path and filename might be returned (with a backsalsh, with quotes
if it contains spaces, etc.)

Sub GetFilePath()
Dim sFilename As String
Dim sFilePath As String
Dim dlgSaveAs As Dialog

Set dlgSaveAs = Dialogs(wdDialogFileOpen)
dlgSaveAs.Display
sFilename = dlgSaveAs.Name
'sFilePath = dlgSaveAs.???
sFilePath = CurDir
If Right(sFilePath, 1) <> "\" Then sFilePath = sFilePath & "\"
If Left(sFilename, 1) = Chr$(34) Then
sFilename = Mid(sFilename, 2, Len(sFilename) - 2)
End If

MsgBox Chr(34) & sFilePath & sFilename & Chr(34)

End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-)
 
Back
Top