473,473 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Printing outlook forms in word

1 New Member
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
1 1846
MMcCarthy
14,534 Recognized Expert Moderator MVP
I'm moving this to the Visual Basic forum.

Technical questions are not allowed in the cafe.

ADMIN
May 8 '07 #2

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

Similar topics

9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
2
by: ML | last post by:
This may have been answered lately, but I have not been able to access this group for some time. I am using Access 2000 and Outlook 2000. (Can move to 2002 or 2003 if necessary). Certain...
26
by: Tom Becker | last post by:
Is there a way, from Access, to programmatically click the Send and Receive button in Outlook?
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
8
by: Wayne | last post by:
My supervisor performs the following steps to generate an email notifying recipients of new problem reports: 1) Generate an Access report containing the columnar data and export it to a .rtf...
0
by: sakuragirl1 | last post by:
I have a database where users are entering information into a form and can attach word, mail, powerpoint, etc files. I have code to print word and excel files, but am having difficulty with...
0
by: Jordan Richard | last post by:
I'm designing a new .NET 2.0 Windows Forms application to support users who, amongst other things, need to print letters and envelopes. They currently do such printing by manually managing a...
15
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi everyone! Does anyone know how can I do barcode printing? First of all, I know I have to write a client executable, but how do I communicate with the thermal printer? Using software the...
2
by: deepakfordotnet | last post by:
Hi, First of all let me confess that I could not get the solution to the same problem from an earlier post Printing :by Mr.Richard MSL (dated September 24th 2006) working. (Replied by Mr.Walter...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.