Sign in to follow this  
Followers 0
TripScott

ObjGet error to MS Word in Win7

6 posts in this topic

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

Share this post


Link to post
Share on other sites



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()

Share this post


Link to post
Share on other sites

also you can try with _WordAttach instead of ObjGet

Share this post


Link to post
Share on other sites

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 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

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

Share this post


Link to post
Share on other sites

I moved 32 bit executables from XP to Windows 7 and they just ran fine.


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