Sign in to follow this  
Followers 0
mac2000

_WordCreate error

6 posts in this topic

Hi, need some help from guru of autoit

here is my really simple script:

#include <Word.au3>
$w = _WordCreate()

When i execute it, get error:

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

Enviroment:

Windows 7, Office 2010 beta, Autoit 3.3.6.1

What is really strange, that on one pc with same enviroment all works fine, but on other do not work :(

I there any suggestions, or maybe way to debug or get more description of what going wrong?

Share this post


Link to post
Share on other sites



okay, so problem is not in word.au3 it is somewhere in COM

$w = ObjGet("","Word.Application")

if @error then 
  MsgBox(0,"",@error)
  exit
endif

at moment trying to run this and get error, is there any way to get more info about what is going wrong?

Share this post


Link to post
Share on other sites

For those who will get same errors as i, here is example from autoit documentation:

Global $g_eventerror = 0  ; to be checked to know if com error occurs. Must be reset after handling.

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler


; Performing a deliberate failure here (object does not exist)
$oIE = ObjCreate("Word.Application")
$oIE.visible = 1
$oIE.bogus 
if $g_eventerror then Msgbox(0,"","the previous line got an error.")

Exit 


; This is my custom error handler 
Func MyErrFunc() 
   $HexNumber=hex($oMyError.number,8) 
   Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _
                "Number is: " & $HexNumber & @CRLF & _
                "Windescription is: " & $oMyError.windescription ) 

   $g_eventerror = 1 ; something to check for when this function returns 
Endfunc

get error code 80020006 and description Unknown name

as about enviroment, there are just one differnce between is translation of windows, on one pc it is english, on other it is russian, so maybe problems come from here...

Share this post


Link to post
Share on other sites

found where problem occurs

in word.au3 there is many checks like this: __WordIsObjType($o_object, "application")

in that function they get ObjName and check it to be equal to _Application

and here is where problem occurs: in my case ObjName return empty string and error

Share this post


Link to post
Share on other sites

seems to be autoit bug

here is code:

$w = ObjCreate("Word.Application")
$w.visible = True

if @error then Msgbox(0,"","ObjCreate " & @error) EndIf

If Not IsObj($w) Then MsgBox(0,"","$w is not obj") EndIf 
if @error then Msgbox(0,"","IsObj " & @error) EndIf

$on = ObjName($w)
if @error then 
    Msgbox(0,"","ObjName " & @error)
EndIf

msgbox(0,"",$on )

$w.Quit(-2,1,0)

expecting to get message with object name

but recieve message ObjName 1

Share this post


Link to post
Share on other sites

Hi mac2000,

How did you solve your problem? I am having the same problem you had: some kind of COM error. I have two PCs both with OFFiCE 2010, one of the PCs words perfectly and the other doesn´t.

Thanks

Felippe Kilian

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