Below is code that works just fine. It outputs text from a form into a MSWord template. I would like to have the output type the text in uppercase & bold.
Any help??
Private Sub MergeButton_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application"
With objWord
.Visible = True
.Documents.Open ("D:\Documents and Settings\air1jcw\Desktop\Access VB Fun Practice\Ch1114.dot"
.ActiveDocument.ShowSpellingErrors = False
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("WWReviewGTWYs"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!ATTN))
.ActiveDocument.Bookmarks("IID"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!IID1))
.ActiveDocument.Bookmarks("Fleettype"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!FleetType))
.ActiveDocument.Bookmarks("Nomenclature"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!Nomenclature))
.ActiveDocument.Bookmarks("PN"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!PN))
.ActiveDocument.Bookmarks("GTWY1"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!GTWY1))
.ActiveDocument.Bookmarks("Hashave"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!hashave))
.ActiveDocument.Bookmarks("Deallocationreason"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!DeAllocationReason))
.ActiveDocument.Bookmarks("GTWY2"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!GTWY2))
.ActiveDocument.Bookmarks("GTWY3"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!GTWY3))
.ActiveDocument.Bookmarks("TotAlloc"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!TotalAllocations))
.ActiveDocument.Bookmarks("BOstatement"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!BO))
.ActiveDocument.Bookmarks("Summary"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!Summary))
.ActiveDocument.Bookmarks("IID2"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!IID1))
.ActiveDocument.Bookmarks("Totalcost"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!TotalCost))
.ActiveDocument.Bookmarks("email"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!emailcontact))
.ActiveDocument.Bookmarks("Atlas"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!ATLAS))
.ActiveDocument.Bookmarks("Phone"
.Select
.Selection.Text = (CStr(Forms!WWRDataEntry!PHONE))
End With
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
End If
End Sub
Any help??
Private Sub MergeButton_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application"
With objWord
.Visible = True
.Documents.Open ("D:\Documents and Settings\air1jcw\Desktop\Access VB Fun Practice\Ch1114.dot"
.ActiveDocument.ShowSpellingErrors = False
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("WWReviewGTWYs"
.Selection.Text = (CStr(Forms!WWRDataEntry!ATTN))
.ActiveDocument.Bookmarks("IID"
.Selection.Text = (CStr(Forms!WWRDataEntry!IID1))
.ActiveDocument.Bookmarks("Fleettype"
.Selection.Text = (CStr(Forms!WWRDataEntry!FleetType))
.ActiveDocument.Bookmarks("Nomenclature"
.Selection.Text = (CStr(Forms!WWRDataEntry!Nomenclature))
.ActiveDocument.Bookmarks("PN"
.Selection.Text = (CStr(Forms!WWRDataEntry!PN))
.ActiveDocument.Bookmarks("GTWY1"
.Selection.Text = (CStr(Forms!WWRDataEntry!GTWY1))
.ActiveDocument.Bookmarks("Hashave"
.Selection.Text = (CStr(Forms!WWRDataEntry!hashave))
.ActiveDocument.Bookmarks("Deallocationreason"
.Selection.Text = (CStr(Forms!WWRDataEntry!DeAllocationReason))
.ActiveDocument.Bookmarks("GTWY2"
.Selection.Text = (CStr(Forms!WWRDataEntry!GTWY2))
.ActiveDocument.Bookmarks("GTWY3"
.Selection.Text = (CStr(Forms!WWRDataEntry!GTWY3))
.ActiveDocument.Bookmarks("TotAlloc"
.Selection.Text = (CStr(Forms!WWRDataEntry!TotalAllocations))
.ActiveDocument.Bookmarks("BOstatement"
.Selection.Text = (CStr(Forms!WWRDataEntry!BO))
.ActiveDocument.Bookmarks("Summary"
.Selection.Text = (CStr(Forms!WWRDataEntry!Summary))
.ActiveDocument.Bookmarks("IID2"
.Selection.Text = (CStr(Forms!WWRDataEntry!IID1))
.ActiveDocument.Bookmarks("Totalcost"
.Selection.Text = (CStr(Forms!WWRDataEntry!TotalCost))
.ActiveDocument.Bookmarks("email"
.Selection.Text = (CStr(Forms!WWRDataEntry!emailcontact))
.ActiveDocument.Bookmarks("Atlas"
.Selection.Text = (CStr(Forms!WWRDataEntry!ATLAS))
.ActiveDocument.Bookmarks("Phone"
.Selection.Text = (CStr(Forms!WWRDataEntry!PHONE))
End With
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
End If
End Sub