I've tried a number of methods found on the internet, but all seem to cause an error.
I need have a macro that opens an existing file in Word. Anybody have some code that works for them.
Here's one example of what I've found:
Thanks for any help. - MacPHP Code:
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub Shell_Execute(Path, File_Name)
' From John Wallenbeck
' 1/19/16 WML
Dim objWord
Dim objDoc
Dim Result As Long
Prog = "Shell_Execute"
If Right(Path, 1) <> "\" Then _
Path = Path & "\"
FileName = Path & File_Name
Rt_F_N = Right(FileName, 60)
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(FileName)
objWord.Visible = True
End Sub ' Shell_Execute
Bookmarks