TripScott Posted April 6, 2011 Share Posted April 6, 2011 Hello. I have a script that runs a MS Word macro. It has worked for over a year just fine in Word 2007 (*32) under Windows XP x32. My company is upgrading everyone to Windows 7 (x64). I cannot get AutoIt to get the Word 2007 (*32) object so the macro runs. I receive this error: "--> Word.au3 Error from function _WordMacroRun, $_WordStatus_InvalidDataType." $oWordApp = ObjGet("", "Word.Application") $oWordDoc = ObjName("", "Word.Application.Documents") WinWait("[REGEXPTITLE:^.* - Microsoft Word$]", "") If Not WinActive("[REGEXPTITLE:^.* - Microsoft Word$]", "") Then WinActivate("[REGEXPTITLE:^.* - Microsoft Word$]", "") WinWaitActive("[REGEXPTITLE:^.* - Microsoft Word$]", "") $oWordDoc = WinActivate("[REGEXPTITLE:^.* - Microsoft Word$]", "") _WordMacroRun($oWordApp, "pMassLoadFromPIM") I have recompiled the script to UseX64=y. I also tried UseX64=n, which didn't work either. What is different in Windows 7 x64 that would cause this script to not work when it works in Windows XP X32? Interestingly enough the ObjGet does work for Excel and I am able to read and write to the spreadsheet. Thanks for any help. My team is counting on me. Kristine Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 6, 2011 Moderators Share Posted April 6, 2011 Try running the code in SciTE with the following at the top of your script. #AutoIt3Wrapper_UseX64 = n It would also help if you add the following toward the top of your script before using any _Word* functions. _WordErrorHandlerRegister() Link to comment Share on other sites More sharing options...
gigi1 Posted April 7, 2011 Share Posted April 7, 2011 also you can try with _WordAttach instead of ObjGet Link to comment Share on other sites More sharing options...
water Posted April 7, 2011 Share Posted April 7, 2011 I had a similar problem: OS was Windows 7 64 bit, Office 2010 was 32 bit, the AutoIt script was compiled for 64 bit. As soon as I compiled the AutoIt script for 32 bit everything was working fine again. A 32 bit COM doesn't work well with a 64 bit application. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
TripScott Posted April 7, 2011 Author Share Posted April 7, 2011 I had a similar problem: OS was Windows 7 64 bit, Office 2010 was 32 bit, the AutoIt script was compiled for 64 bit. As soon as I compiled the AutoIt script for 32 bit everything was working fine again.A 32 bit COM doesn't work well with a 64 bit application.That was it exactly!! Thank you very much! I was recompiling all my scripts in W7x64 because some of them would fail when I tried to run them. But those weren't the Word scripts. This leads me to a compile question. Is there a difference (for execution purposes) between compiling on an XP x32 machine in x32 mode and W7x64 in x32 mode? Kristine Link to comment Share on other sites More sharing options...
water Posted April 7, 2011 Share Posted April 7, 2011 I moved 32 bit executables from XP to Windows 7 and they just ran fine. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - 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