Error: Object Required: 'documents.add' Code: 800A01A8 On Windows 7 Office 2010

I'm getting the error below when executing the below code on Windows 7 64bit Office 2010 machines at my company.

Script: word.vbs
Line 6 Char 1
Error: Object Required: 'documents.add' 
Code: 800A01A8
Source: MS VBScript runtime error

Open in new window

dim word
set word=createobject("Word.Application")

dim document
set document=word.documents.add

Open in new window

The code was given to me for testing purposes by a 3rd party application support company. It should just open a blank document in Word.

I've tried this on many different machines running a variety of Windows 7 64bit Office 2010 machines and get a seemly random mix of errors and successes. I have tried fully enabling macros and lowering security.

On one machine the script will return the error if Word is already open but will work successfully if not.

Does anyone know of any prevailing conditions or settings which will determine whether this will work?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try not calling the variable 'word'
Call it objWord or wordApp or something.
There is a site which details similar issues - the fix for them was a MS hotfix.

Can you try the code below to see if that works for your toubled machines?
on error resume next

Dim word
Dim document
Dim isWorking
Dim escapeFromLoop

set word = createobject("Word.Application")

isWorking = false
escapeFromLoop = 0
	escapeFromLoop = escapeFromLoop + 1
	set document = word.documents.add()
	if err.number <> 0 then
		wscript.sleep 500
		isWorking = true
	end if
	if escapeFromLoop = 10 then
		wscript.echo "Error adding Word object"
	end if
loop until isWorking = true

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
support01Author Commented:
Thanks rejoinder, haven't tried hotfix but new line of code works a treat

dim wordapp
set wordapp=createobject("Word.Application")
Wscript.Sleep 500
dim document
set document=wordapp.documents.add

Open in new window

Glad that helped and thanks for the points :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.