472,989 Members | 3,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 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
objWord.Quit(0)
End Sub
May 8 '07 #1
1 1819
MMcCarthy
14,534 Expert Mod 8TB
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.