• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 57
  • Last Modified:

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
0
rvfowler2
Asked:
rvfowler2
  • 2
  • 2
1 Solution
 
GrahamSkanRetiredCommented:
Is "UPCSetupStarter" the correct name for your document file? It has no extension.
0
 
rvfowler2Author Commented:
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.
0
 
GrahamSkanRetiredCommented:
The 'object required' error is a bit confusing.
0
 
rvfowler2Author Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now