enggniteshgarg Posted April 5, 2012 Share Posted April 5, 2012 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????? Link to comment Share on other sites More sharing options...
water Posted April 5, 2012 Share Posted April 5, 2012 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 5, 2012 Moderators Share Posted April 5, 2012 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. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Sliver Posted April 5, 2012 Share Posted April 5, 2012 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) Link to comment Share on other sites More sharing options...
water Posted April 5, 2012 Share Posted April 5, 2012 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 5, 2012 Moderators Share Posted April 5, 2012 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. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
enggniteshgarg Posted April 5, 2012 Author Share Posted April 5, 2012 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_InvalidObjectTypeC:Usersq04933DesktopAutoItMultitask.au3 (4) : ==> Variable must be of type "Object".:$oDoc.Range.insertAfter ("This is some text to insert.")$oDoc^ ERROR Link to comment Share on other sites More sharing options...
water Posted April 5, 2012 Share Posted April 5, 2012 Do you compile the script for 32 bit? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
enggniteshgarg Posted April 5, 2012 Author Share Posted April 5, 2012 Thanks a lot Water...............I am not getting any error after compiling the script for 32 bit.............. Link to comment Share on other sites More sharing options...
water Posted April 6, 2012 Share Posted April 6, 2012 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now