maestro1024 Posted April 24, 2008 Share Posted April 24, 2008 I am trying to log information to a word object. It always starts word but then I am not seeing this all the time but sometimes I get the following error. It is like the path is bad maybe but I am not sure how to debug what path it thinks it has (if that is really the problem). I have no idea why this is occuring. Any ideas what I should look at? OK Line 583 (File "C:\Program Files\AutoIt3\Include\Word.au3"): $o_object.SaveAs ($s_FilePath, $i_Format, $f_LockComments, $s_Password, $f_AddToRecentFiles, $s_WritePassword, $f_ReadOnlyRecommended) $o_object.SaveAs ($s_FilePath, $i_Format, $f_LockComments, $s_Password, $f_AddToRecentFiles, $s_WritePassword, $f_ReadOnlyRecommended)^ ERROR Error: The requested action with this object has failed. Link to comment Share on other sites More sharing options...
maestro1024 Posted April 24, 2008 Author Share Posted April 24, 2008 ok. I no how to recreate. If I have a full path name like C:\test\test.doc that will crash. if I use test.doc Does the word object require me to strip off the path? Or should it handle that full path name? Link to comment Share on other sites More sharing options...
ResNullius Posted April 24, 2008 Share Posted April 24, 2008 ok.I no how to recreate.If I have a full path name likeC:\test\test.docthat will crash.if I use test.docDoes the word object require me to strip off the path? Or should it handle that full path name?How/where are you creating the document?_WordDocSave saves the document to the same location it was created._WordDocSaveAs will allow you to save it in a different location.It will be easier to help if you show your document creation code, including any file path you are designating when creating the doc. Link to comment Share on other sites More sharing options...
maestro1024 Posted April 24, 2008 Author Share Posted April 24, 2008 I was able to use pathsplit and get just the name and extension. After I pass in just the name and extension I am ok. It was my bug anyway. Here is the code I use to log. I was add the directory again which would not make sense. CODEFunc LogToWord($wordLogFileName,$text) $oWordApp = _WordCreate(@ScriptDir & "/" & $wordLogFileName) $oDoc = _WordDocGetCollection($oWordApp, 0) $oSelection = $oWordApp.Selection $oSelection.TypeText($text) $oSelection.TypeParagraph() EndFunc Link to comment Share on other sites More sharing options...
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