gmaxey
10-20-2015, 04:22 AM
Sub ScratchMacro()
'Due to a document managment system, I need to set a document object variable based on the user's selection
'from the file open dialog.
Dim oDoc As Word.Document
If Application.Dialogs(wdDialogFileOpen).Show = -1 Then
'It seems the new document is always indexed as 1 but I'm not sure.
Set oDoc = Documents(1)
'What I would really like is a way to just display the File Open dialog and get the FullName (Path and File name) of the file selected
'validate it and then explicitly Set oDoc = Documents.Open(Path and File name).
'Any ideas?
End If
MsgBox oDoc.FullName
lbl_Exit:
Exit Sub
End Sub
Thanks!
'Due to a document managment system, I need to set a document object variable based on the user's selection
'from the file open dialog.
Dim oDoc As Word.Document
If Application.Dialogs(wdDialogFileOpen).Show = -1 Then
'It seems the new document is always indexed as 1 but I'm not sure.
Set oDoc = Documents(1)
'What I would really like is a way to just display the File Open dialog and get the FullName (Path and File name) of the file selected
'validate it and then explicitly Set oDoc = Documents.Open(Path and File name).
'Any ideas?
End If
MsgBox oDoc.FullName
lbl_Exit:
Exit Sub
End Sub
Thanks!