K
Kenny G
Hi,
I'm getting the above error message when I use the following code. I am new
to Access/Word Automation. Would someone tell me what I did wrong?
Sub PrintConsentLetterWithWord(frmConsent)
Dim objWord As Word.Application
Dim objDoc As Word.Document
'Launch Word and load the ConsentLetter template
Set objWord = New Word.Application
objWord.Visible = False
Set objDoc = objWord.Documents.Add("S:\Quality & Process
Improvement\QPI\ RWJ Consent DB\RWJProviderLetter.dot")
'Add information using predefined bookmarks
With objDoc.Bookmarks
.Item("MedicalRecordsNumber").Range.Text = frmConsent.MRN
.Item("FirstName").Range.Text = frmConsent.FName
.Item("LastName").Range.Text = frmConsent.LName
.Item("Provider").Range.Text = frmConsent.Provider
.Item("Employee").Range.Text = frmConsent.Employee
End With
objWord.PrintOut
objDoc.Close wdDoNotSaveChanges
objWord.Quit
End Sub
Thank You,
I'm getting the above error message when I use the following code. I am new
to Access/Word Automation. Would someone tell me what I did wrong?
Sub PrintConsentLetterWithWord(frmConsent)
Dim objWord As Word.Application
Dim objDoc As Word.Document
'Launch Word and load the ConsentLetter template
Set objWord = New Word.Application
objWord.Visible = False
Set objDoc = objWord.Documents.Add("S:\Quality & Process
Improvement\QPI\ RWJ Consent DB\RWJProviderLetter.dot")
'Add information using predefined bookmarks
With objDoc.Bookmarks
.Item("MedicalRecordsNumber").Range.Text = frmConsent.MRN
.Item("FirstName").Range.Text = frmConsent.FName
.Item("LastName").Range.Text = frmConsent.LName
.Item("Provider").Range.Text = frmConsent.Provider
.Item("Employee").Range.Text = frmConsent.Employee
End With
objWord.PrintOut
objDoc.Close wdDoNotSaveChanges
objWord.Quit
End Sub
Thank You,