Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / September 2003

Tip: Looking for answers? Try searching our database.

Printing Forms in OL2002

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott Posey - 30 Sep 2003 13:57 GMT
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
Sue Mosher [MVP] - 30 Sep 2003 14:16 GMT
Code runs only from published forms, not from one-off items. See http://www.slipstick.com/outlook/esecup/formsec.htm 

Signature

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
    http://www.outlookcode.com/jumpstart.aspx 

> Hello,
>  Thanks for taking a look, anyway my problem:
[quoted text clipped - 5 lines]
> person whom I would ultimately like to get a nice
> customized print form.
Scott Posey - 30 Sep 2003 16:56 GMT
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

>> Hello,
>>  Thanks for taking a look, anyway my problem:
[quoted text clipped - 7 lines]
>
>.
Sue Mosher - 30 Sep 2003 18:41 GMT
I just can't type:
http://www.slipstick.com/outlook/esecup.htm#formsec
Signature

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
    http://www.outlookcode.com/jumpstart.aspx 

>-----Original Message-----
>Sue,
[quoted text clipped - 23 lines]
>>
>.
Scott Posey - 30 Sep 2003 19:15 GMT
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
>-----Original Message-----
>I just can't type:
[quoted text clipped - 33 lines]
>>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.