StenchBlossoms Posted May 7, 2010 Share Posted May 7, 2010 Hi guys, Recently starting to use AutoIt and I'm trying to fill in a form I have which in .doc format. I've tried the following so far but I'm not getting any postive results. #NoTrayIcon #include<Word.au3> $formName = "\form.doc" $word = ObjCreate("Word.Application") $word.visible = True $word.Documents.open($formName) $word.Selection.Find.Text = "Name:"; $word.Selection.Find.ClearFormatting(); $word.Selection.Find.Replacement.Text = "Name: John"; $word.Selection.Find.Replacement.ClearFormatting(); $word.Selection.Find.Forward = true; $word.Selection.Find.Execute Would anyone be able to help? Link to examples of this? I've already looked through the help documents but haven't found anything similar. Thanks Link to comment Share on other sites More sharing options...
SAG Posted May 8, 2010 Share Posted May 8, 2010 (edited) Check the Word management UDF functions in the AutoIt Help files. In your example, it might look like this: #include <Word.au3> $oWordApp = _WordCreate("", 0, 0) $oWord = _WordDocOpen($oWordApp, $formName) _WordDocFindReplace($oWord, "Name:", "Name: John") _WordDocSave($oWord) _WordDocClose($oWord) _WordQuit($oWordApp) Edit: made example more complete Edited May 8, 2010 by SAG Link to comment Share on other sites More sharing options...
StenchBlossoms Posted May 9, 2010 Author Share Posted May 9, 2010 Check the Word management UDF functions in the AutoIt Help files. In your example, it might look like this: #include <Word.au3> $oWordApp = _WordCreate("", 0, 0) $oWord = _WordDocOpen($oWordApp, $formName) _WordDocFindReplace($oWord, "Name:", "Name: John") _WordDocSave($oWord) _WordDocClose($oWord) _WordQuit($oWordApp) Edit: made example more complete Thank you. I will try this. 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