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 and doesn't wait for Word to close. Anybody have some code that works for this?
Here's one example of what I've found:
PHP 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 FileName As String Dim Result As Long If Right(Path, 1) <> "\" Then _ Path = Path & "\"
FileName = Path & File_Name Result = ShellExecute(0&, vbNullString, FileName, _ vbNullString, vbNullString, vbNormalFocus) If Result < 32 Then MsgBox "Error"
The problem turned out to be trivial: I had the name of the program name with 3 "T"'s in it rather than 2. And my error checking software was catching it but I wasn't smart enough to figure that out until now.
Bookmarks