-
1
- #1
If you are just doing a simple document then somethign like the following will work:
(remember to correctly close and destroy your objects though).
If you are doing something more complicated then do what Rick suggested as it will allow you to create a template file and you can do all the formatting there.
----------------------------------------------------------------------
Need help finding an answer?
Try the search facility ( or read FAQ222-2244 on how to get better results.
Code:
' Declarations
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTable As Word.Table
Dim oPara1 As Word.Paragraph
Dim oPara2 As Word.Paragraph
'Start Word and open the document template.
oWord = New Word.Application
oWord.Visible = True
' Create A New Document
oDoc = oWord.Documents.Add
'Add a paragraph
oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Here's My First Bit Of Text"
oPara1.Range.Font.Bold = True
oPara1.Range.InsertParagraphAfter()
' Add another paragraph
oPara2 = oDoc.Content.Paragraphs.Add
oPara2.Range.Text = "Here's My First Bit Of Text"
oPara2.Range.InsertParagraphAfter()
If you are doing something more complicated then do what Rick suggested as it will allow you to create a template file and you can do all the formatting there.
----------------------------------------------------------------------
Need help finding an answer?
Try the search facility ( or read FAQ222-2244 on how to get better results.