Negative1 Posted May 10, 2011 Share Posted May 10, 2011 (edited) Hi All, #include <Word.au3> $oWordApp = _WordCreate (@ScriptDir & "\Test.doc", 0, 0) $oDoc = _WordDocGetCollection ($oWordApp, 0) $oDoc.Range.insertAfter ("This is some text to insert.") $oDoc = _WordDocGetCollection ($oWordApp, 0) $oDoc.Range.insertAfter ("This is some color text to insert.") So basically the above code I want to display two lines the first in default font/color and second in another color. I would also be happy if I could make the second line bold instead of color... Is this possible? Thanks, -1 Edit1: Thanks Smartee! Edited May 10, 2011 by Negative1 What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world. Link to comment Share on other sites More sharing options...
smartee Posted May 10, 2011 Share Posted May 10, 2011 hi -1,Try this:#include <Word.au3> $oWordApp = _WordCreate(@ScriptDir & "\Test.doc", 1) $oDoc = _WordDocGetCollection($oWordApp, 0) $oDoc.Range.insertAfter("This is some text to insert. ") $oDoc.Range.insertAfter("This is some text to make bold. ") $oDoc.Range.insertAfter("This is some text to make red. ") $mySentence = $oDoc.Sentences(2) $mySentence.Font.Bold = True $mySentence = $oDoc.Sentences(3) $mySentence.Font.Color = 0x0000FFYou can explore MSDN: Microsoft Office Development if you want to do magical stuff with the application objects provided by Microsoft Office. Hope this helps, -smartee Link to comment Share on other sites More sharing options...
kilian14 Posted November 7, 2011 Share Posted November 7, 2011 Where in the MSDN web page do I find the properties of the object that is created :$mySentence = $oDoc.Sentences(2)$mySentence.Font.Color = 0x0000FFHere you have the property to change the color of the text. I actually need the property to aling the text.Thanks 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