Sign in to follow this  
Followers 0
enggniteshgarg

Winword.au3

10 posts in this topic

Hi All,

I am new to AutoIT. I just want to create a new word document. But _WordCreate function is not working.

#include <Word.au3>

$oWordApp = _WordCreate (@ScriptDir & "\Test.docx")

After running above lines i am getting error like "Word.au3 Error from function _WordDocOpen, $_WordStatus_InvalidObjectType"

Does anyone has any idea?????

Share this post


Link to post
Share on other sites



What version of AutoIt do you use?

What version of Windows do you use? 32 or 64 bit?

What version of Office do you use? 32 or 64 bit?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi, enggniteshgarg. I am using Office 2010, and can replicate the error you're seeing if I attempt to create it as a .docx. I do not, however, see the issue if I create it as a .doc. Can you please try it as a .doc and see if you still get an error? You can always do what you need to do and then save as a .docx later if you need.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I ran into a similar issue today. I am writing a script that does a FindReplace on an existing document and running into problems. I tried saving the .docx as a .doc but it still doesn't work. I am running Windows 7 64bit with Office 2010 64 bit.

--> Word.au3 Warning from function _WordCreate, Cannot register internal error handler, cannot trap COM errors (Use _WordErrorHandlerRegister() to register a user error handler)

--> Word.au3 Warning from function internal function __WordIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _WordErrorHandlerRegister() to register a user error handler)

--> Word.au3 Error from function _WordDocOpen, $_WordStatus_InvalidObjectType

--> Word.au3 Warning from function internal function __WordIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _WordErrorHandlerRegister() to register a user error handler)

Share this post


Link to post
Share on other sites

Office 64 bit is not recommended (not even by MS) and often causes problems. There was a thread about 32/64 bit Office which I cant't find at the moment.

Do you have the 32 bit version on another computer? if yes, try your script there but make sure the AutoIt script runs or compiles for 32 bit!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Office 64 bit is not recommended (not even by MS) and often causes problems.

I've seen where MS says don't use it, but I just saw you can still buy it on Newegg ;) Nothing like a company that hopes you'll continue to buy even their worst products.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

What version of AutoIt do you use?

What version of Windows do you use? 32 or 64 bit?

What version of Office do you use? 32 or 64 bit?

I use Autoit 3..3.6.0 on Windows 7 64 bit machine with office 2010 32 bit.

script :

#include <Word.au3>

$oWordApp = _WordCreate (@DesktopDir & "Test.doc")

$oDoc = _WordDocGetCollection ($oWordApp, 0)

$oDoc.Range.insertAfter ("This is some text to insert.")

;_WordQuit ($oWordApp, -1)

Error what i am getting:

I tried ruing the script with doc also still i am getting error

--> Word.au3 Error from function _WordDocGetCollection, $_WordStatus_InvalidObjectType

C:Usersq04933DesktopAutoItMultitask.au3 (4) : ==> Variable must be of type "Object".:

$oDoc.Range.insertAfter ("This is some text to insert.")

$oDoc^ ERROR

Share this post


Link to post
Share on other sites

Do you compile the script for 32 bit?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks a lot Water...............I am not getting any error after compiling the script for 32 bit..............

Share this post


Link to post
Share on other sites
;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0