Jump to content

_WordCreate error


Recommended Posts

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?

Link to comment
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...

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • 1 year later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...