471,620 Members | 1,327 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,620 software developers and data experts.

Printing outlook forms in word

I have used the ff command but only get the date printout and have no clue whats wrong:

'Printing function
' - opening a Word template with bookmarks
' - read bookmarks list from template and match with the field names in Outlook form
' - value in form is that populated to the Word doc for auto-printing
' - prompt user for closing Word when printing is done.
' - Save word as C:\deletme.doc before exiting Word.
' 8/21/98 Leng Ho
' 9/16/98 modified to include remove save C:\deletme.doc function
' remove visibility of Word
' correct problem by using Item.UserProperties.find(strField).value

Dim strTemplate
Dim objWord
Dim objDocs
Dim PageRange
Dim strField
Dim strField1

Sub cmdPrint_Click

Set objWord = CreateObject("Word.Application")

' Put the name of your Word template that contains the bookmarks
strTemplate = "Facility Request.dot"

' Location of Word template; could be on a shared LAN
'strTemplate = "C:\Documents and Settings\Belindam\My Documents\Outlook\" & strTemplate
strTemplate = "C:\Documents and Settings\Belindam\My Documents\TEST.doc"

Set objDocs = objWord.Documents
objDocs.Add strTemplate
set mybklist = objWord.ActiveDocument.Bookmarks

'NB!! Not best practice - for testing

'Set the bookmarks
objWord.ActiveDocument.Bookmarks("Date").Range.tex t = date
objWord.ActiveDocument.Bookmarks("Department").Ran ge.text = department
objWord.ActiveDocument.Bookmarks("Request").Range. text = request
objWord.ActiveDocument.Bookmarks("Priority").Range .text = Priority
objWord.ActiveDocument.Bookmarks("Requester").Rang e.text = requester
objWord.ActiveDocument.Bookmarks("TelNo").Range.te xt = telNo
objWord.ActiveDocument.Bookmarks("Deadline").Range .text = DeadLineDate

objWord.PrintOut Background = True
End Sub
May 8 '07 #1
1 1750
14,534 Expert Mod 8TB
I'm moving this to the Visual Basic forum.

Technical questions are not allowed in the cafe.

May 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Jody Gelowitz | last post: by
26 posts views Thread by Tom Becker | last post: by
12 posts views Thread by Alex Clark | last post: by
reply views Thread by sakuragirl1 | last post: by
15 posts views Thread by =?Utf-8?B?cGF0cmlja2RyZA==?= | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.