Printing Forms in OL2002

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
 
S

Scott Posey

Sue,
Thanks for the help I tried to refer to that article
though and I am getting a 404 error, maybe the article has
moved?

Any help would be appreciated, I tried doing several
searches with little luck.

Thanks

Scott
-----Original Message-----
Code runs only from published forms, not from one-off
items. See
http://www.slipstick.com/outlook/esecup/formsec.htm
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers



"Scott Posey" <[email protected]> wrote in
message news:[email protected]...
 
S

Scott Posey

Thank you Sue, I was able to figure out the problem based
on the information in the link.

I didn't realize I couldn't publish with form definition
in the message.

Thanks again.

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top