Link to home
Start Free TrialLog in
Avatar of rvfowler2
rvfowler2Flag for United States of America

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:\fmExports\MastersandMacros\UPCSetupStarter")

Dim wdApp, wdWb

Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set wdWb = wdApp.documents.Open("R:\fmExports\MastersandMacros\UPCSetupStarter")

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
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rvfowler2

ASKER

Ha, that did it.  Didn't even consider an extension as I haven't changed this in 8 years.  Have to find out who's been messing with my files.
The 'object required' error is a bit confusing.
Thanks.