Jump to content
Sign in to follow this  

_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


Windows 7, Office 2010 beta, Autoit

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

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
if $g_eventerror then Msgbox(0,"","the previous line got an error.")


; This is my custom error handler 
Func MyErrFunc() 
   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 

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)

msgbox(0,"",$on )


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.


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...