Edited by HansV to preserve indentation (by putting <!t>[pre]<!/t> and <!t>[/pre]<!/t> tags around the code), and to correct some text messed up by the Lounge software/Browser.
I am trying to send data from an access data table to a microsoft word document. I am having mixed results. I have been able to send fields but I have not been able to format the text properly. I want to create the first line ("Test Results") to be bold and centered. Everyother line I want to be not bold and left aligned. I know there is probable some easy way to do this multiple formatting but I have been unable to figure it out. Here is what I have so far:
<pre>Private Sub Command0_Click()
On Error GoTo errorHandler
Dim wdApp As Word.Application
Dim myDoc As Word.Document
Dim mywdRange As Word.Range
Set wdApp = New Word.Application
With wdApp
.Visible = True
.WindowState = wdWindowStateMaximize
End With
Set myDoc = wdApp.Documents.Add
Set mywdRange = myDoc.Words(1)
With mywdRange
.Text = "Test Results"
.FormattedText.Bold = True
.Text = .Text & "1. Trial 1 Results: " & Me.<!t>[Trial_1]<!/t>
.GoToNext wdGoToLine
.Text = .Text & "2. Trial Location and Date Tested: " & _
Me.<!t>[Trial Location]<!/t> & " Date:" & Me.[Date]
.GoToNext wdGoToLine
.Text = .Text & "3. Success Rate: " & Me.[Success Rate]
.GoToNext wdGoToLine
.AutoFormat
.ParagraphFormat.LineSpacing = 24
.Font.Name = "Times New Roman"
.Font.Size = 12
.Font.ColorIndex = wdBlack
.Bold = False
End With
errorHandler:
Set wdApp = Nothing
Set myDoc = Nothing
Set mywdRange = Nothing
End Sub
</pre>



