By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,639 Members | 2,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,639 IT Pros & Developers. It's quick & easy.

Printing outlook forms in word

P: 1
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
objWord.Quit(0)
End Sub
May 8 '07 #1
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
I'm moving this to the Visual Basic forum.

Technical questions are not allowed in the cafe.

ADMIN
May 8 '07 #2

Post your reply

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