S
Scott Posey
Hello,
Thanks for taking a look, anyway my problem:
I was able to follow Q290775 to create a word template and
have a email form print cleanly, but my problem is once
the email is sent it will no longer print, it will only
print using the Word template before being sent to the
person whom I would ultimately like to get a nice
customized print form.
The code for the for is as follows: (Basically ripped
right from the Q article)
Sub cmdPrint_Click()
Set oWordApp = CreateObject("Word.Application")
If oWordApp Is Nothing Then
MsgBox "Couldn't start Word."
Else
Dim oWordApp
Dim oWordDoc
Dim bolPrintBackground
' Open a new document
Set oDoc = oWordApp.Documents.Add("C:\MyForm.dot")
' Set the first bookmark to the contact's full name
'oDoc.FormFields("Text1").Result = CStr
(Item.FullName)
' Set the second bookmark to the contact's birthday
'oDoc.FormFields("Text2").Result = CStr
(Item.Birthday)
' If the form contains user-defined fields, you can
use
' the following syntax to transfer the contents of a
' user-defined field (FieldName) to Word:
strMyField = Item.UserProperties.Find("Quantity 1")
oDoc.FormFields("Text1").Result = strMyField
strMyField = Item.UserProperties.Find("Description
1")
oDoc.FormFields("Text2").Result = strMyField
' Get the current Word setting for background
printing
bolPrintBackground = oWordApp.Options.PrintBackground
' Turn background printing off
oWordApp.Options.PrintBackground = False
' Print the Word document
oDoc.PrintOut
' Restore previous setting
oWordApp.Options.PrintBackground = bolPrintBackground
' Close and don't save changes to the document
Const wdDoNotSaveChanges = 0
oDoc.Close wdDoNotSaveChanges
' Close the Word instance
oWordApp.Quit
' Clean up
Set oDoc = Nothing
Set oWordApp = Nothing
End If
End Sub
I was wondering if anyone had some insight as to why it
will not work correctly after sending it.
Thanks
Scott
Thanks for taking a look, anyway my problem:
I was able to follow Q290775 to create a word template and
have a email form print cleanly, but my problem is once
the email is sent it will no longer print, it will only
print using the Word template before being sent to the
person whom I would ultimately like to get a nice
customized print form.
The code for the for is as follows: (Basically ripped
right from the Q article)
Sub cmdPrint_Click()
Set oWordApp = CreateObject("Word.Application")
If oWordApp Is Nothing Then
MsgBox "Couldn't start Word."
Else
Dim oWordApp
Dim oWordDoc
Dim bolPrintBackground
' Open a new document
Set oDoc = oWordApp.Documents.Add("C:\MyForm.dot")
' Set the first bookmark to the contact's full name
'oDoc.FormFields("Text1").Result = CStr
(Item.FullName)
' Set the second bookmark to the contact's birthday
'oDoc.FormFields("Text2").Result = CStr
(Item.Birthday)
' If the form contains user-defined fields, you can
use
' the following syntax to transfer the contents of a
' user-defined field (FieldName) to Word:
strMyField = Item.UserProperties.Find("Quantity 1")
oDoc.FormFields("Text1").Result = strMyField
strMyField = Item.UserProperties.Find("Description
1")
oDoc.FormFields("Text2").Result = strMyField
' Get the current Word setting for background
printing
bolPrintBackground = oWordApp.Options.PrintBackground
' Turn background printing off
oWordApp.Options.PrintBackground = False
' Print the Word document
oDoc.PrintOut
' Restore previous setting
oWordApp.Options.PrintBackground = bolPrintBackground
' Close and don't save changes to the document
Const wdDoNotSaveChanges = 0
oDoc.Close wdDoNotSaveChanges
' Close the Word instance
oWordApp.Quit
' Clean up
Set oDoc = Nothing
Set oWordApp = Nothing
End If
End Sub
I was wondering if anyone had some insight as to why it
will not work correctly after sending it.
Thanks
Scott