lukeneo Posted July 19, 2006 Posted July 19, 2006 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 ....?????????
lukeneo Posted July 19, 2006 Author Posted July 19, 2006 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
Richard Robertson Posted July 19, 2006 Posted July 19, 2006 Check @error after you create it, not after you call something on it.
MHz Posted July 19, 2006 Posted July 19, 2006 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.
lukeneo Posted July 19, 2006 Author Posted July 19, 2006 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. MH ! THANK YOU FOR THE LAST .....I REALLY DONT KNOW ... WHY THE PROBLEM OCCURS .... I HAVE A LEGAL COPY OF MICROSOFT OFFICE XP .?????
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now