Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating Word Documents

Status
Not open for further replies.

Stoomis

Programmer
Jul 8, 2003
31
0
0
US
I using VBScript to launch Microsoft Word and write text to it. I have been able to change font properties (size, fontname, bold...) for the entire document and also for single words.
Set Word = CreateObject("word.application")
set doc = word.documents.add
doc.content.Font.Name = "Arial"
doc.Words(1).Font.Bold = True
What I want to do is change the font for a whole line or a whole paragraph but I have been unable to find any syntax that will accomplish this.
Also when you close the file that has been created is there any way to suppress or bypass the save as dialog? What is the command to exit word? Help is very much appreciated
 
I would go into word and record a macro to do what you are trying to do then look at the code for the macro. It will be in VBA, but it would tell you the objects and properties that you need to use.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top