rvfowler2
asked on
What is the correct VBS open.document object command? Seems to have changed.
When running the following Visual Basic file, which opens a Word document and runs a macro, I get an error 800A01A8 on Line 5 (see below), Object required: 'documents.Open(...)', even though this VBS file has worked for about 8 years now. Since the file name was not changed or moved, guessing that VBS has been updated, but can't find what the correct object command is. Any ideas?
Line 5 seems to be (see also below): Set wdWb = wdApp.documents.Open("R:\f mExports\M astersandM acros\UPCS etupStarte r")
Dim wdApp, wdWb
Set wdApp = CreateObject("Word.Applica tion")
wdApp.Visible = True
Set wdWb = wdApp.documents.Open("R:\f mExports\M astersandM acros\UPCS etupStarte r")
wdApp.Run "FormatUPCSales"
'if the macro takes arguments, use:
'wdApp.Run "FormatUPCSales", "Arg1", "Arg2", "Arg3"
'wdWb.Close True
Set wdWb = Nothing
'wdApp.Quit
Set wdApp = Nothing
Line 5 seems to be (see also below): Set wdWb = wdApp.documents.Open("R:\f
Dim wdApp, wdWb
Set wdApp = CreateObject("Word.Applica
wdApp.Visible = True
Set wdWb = wdApp.documents.Open("R:\f
wdApp.Run "FormatUPCSales"
'if the macro takes arguments, use:
'wdApp.Run "FormatUPCSales", "Arg1", "Arg2", "Arg3"
'wdWb.Close True
Set wdWb = Nothing
'wdApp.Quit
Set wdApp = Nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The 'object required' error is a bit confusing.
ASKER
Thanks.
ASKER