Sign in to follow this  
Followers 0
lukeneo

Somebody To cure this code !

5 posts in this topic

Global $oWord

If Not $CMDLINE[0] Then

MsgBox(0, "", "Usage: doc2txt.exe file.doc")

Exit 1

EndIf

$oWord = ObjCreate("Word.Application")

$oWord.visible = 1 ; Not important to make visible ... CHECKING THE OBJECT CREATION AN OK

If @error Then

MsgBox(0x10, '', 'Object creation failed')

Exit 2

Else

For $i = 1 To $CMDLINE[0]

If FileExists($CMDLINE[$i]) Then

$oWord.Documents.Open('"' & $CMDLINE[$i] & '"')

$oWord.Activedocument.SaveAs('"' & $CMDLINE[$i] & '.rtf"')

$oWord.Activedocument.Close

EndIf

Next

$oWord = ""

EndIf

I GET ERROR MESSAGE

ERROR : THE REQUWSTED ACTION WITH THIS OBJECT HAS FAILED ...

SOME ONE TO CURE THIS HEADACHE ....?????????

Share this post


Link to post
Share on other sites



Global $oWord

If Not $CMDLINE[0] Then

MsgBox(0, "", "Usage: doc2txt.exe file.doc")

Exit 1

EndIf

$oWord = ObjCreate("Word.Application")

$oWord.visible = 1 ; Not important to make visible ... CHECKING THE OBJECT CREATION AN OK

If @error Then

MsgBox(0x10, '', 'Object creation failed')

Exit 2

Else

For $i = 1 To $CMDLINE[0]

If FileExists($CMDLINE[$i]) Then

$oWord.Documents.Open('"' & $CMDLINE[$i] & '"')

$oWord.Activedocument.SaveAs('"' & $CMDLINE[$i] & '.rtf"')

$oWord.Activedocument.Close

EndIf

Next

$oWord = ""

EndIf

I GET ERROR MESSAGE

ERROR : THE REQUWSTED ACTION WITH THIS OBJECT HAS FAILED ...

SOME ONE TO CURE THIS HEADACHE ....?????????

I HAVE USED THE FOLLOWING ALTERNATIVE AS WELL WITH THE SAME ERROR MESSAGE ....

Global $oWord

$oWord = ObjCreate("Word.Application")

$oWord.Documents.Open("FILE.doc")

$oWord.Activedocument.SaveAs("file.rtf")

$oWord.Activedocument.Close

Share this post


Link to post
Share on other sites

Check @error after you create it, not after you call something on it.

Share this post


Link to post
Share on other sites

Not sure why you are getting an object error unless you do not have Word installed...as I mentioned here of testing and using it successfully. :D

Share this post


Link to post
Share on other sites

Not sure why you are getting an object error unless you do not have Word installed...as I mentioned here of testing and using it successfully. :D

MH ! THANK YOU FOR THE LAST .....

I REALLY DONT KNOW ... WHY THE PROBLEM OCCURS ....

I HAVE A LEGAL COPY OF MICROSOFT OFFICE XP .

?????

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