Info Posted May 12, 2010 Share Posted May 12, 2010 I'm having trouble word the _word functions so can anyone help me? I just want it to return true if the text exists in the document or false if the text does not exist. Link to comment Share on other sites More sharing options...
enaiman Posted May 12, 2010 Share Posted May 12, 2010 It can be a little ambiguous - here it is how to do it: $oWord = _WordCreate("my file with full path", 0, 0) ;hidden If _WordDocFindReplace($oWord, "my text") Then MsgBox(0, "found", "text found") Else MsgBox(0, "not found", "text not found") EndIf _WordQuit($oWord) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Info Posted May 13, 2010 Author Share Posted May 13, 2010 I'm getting --> Word.au3 Error from function _WordDocFindReplace, $_WordStatus_InvalidObjectType Link to comment Share on other sites More sharing options...
enaiman Posted May 13, 2010 Share Posted May 13, 2010 Straight from the help file - you should read that by the way. ******************************************************* ; Example 1 - Create a word window, open a document, find "this", ; replace all occurrences with "THIS", quit without saving changes. ; ******************************************************* ; #include <Word.au3> $oWordApp = _WordCreate (@ScriptDir & "\Test.doc") $oDoc = _WordDocGetCollection($oWordApp, 0) $oFind = _WordDocFindReplace($oDoc, "this", "THIS") If $oFind Then MsgBox(0, "FindReplace", "Found and replaced.") Else MsgBox(0, "FindReplace", "Not Found") EndIf _WordQuit ($oWordApp, 0) It looks like my first example wasn't working. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) 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