473,757 Members | 7,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help w/mail merge code

Hi All,
This code is running in WinNT/Access97. I'm looking for some help with
getting this code to do two(2) things better then it does now and I'm
not sure how to do it.
1. On the 'objWord.Applic ation.Quit' statement, it asks if I want to
save changes and I would like it to not ask that and I don't know what
the exact code is to do that.

2. On the 'objWord.MailMe rge.Execute' statement the printer dialog
window pops up and I have to click Ok in order for it to start
printing, how do I pass the OK click to the printer dialog box? I was
thinking something like BackgroundPrint ing=OK but, again I don't know
what the exact code is.
Thanks for any and all help
bobh.

Dim objWord As Word.Document
Set objWord = GetObject("\\Ho mafsf6\Vol2\Bre akpoint\Documen tation\BPPaymen tLtr.doc",
"Word.Document" )
'make Word visible.
objWord.Applica tion.Visible = True
'set the mail merge data source as the database containing the mail
merge data.
objWord.MailMer ge.OpenDataSour ce _
Name:="\\Homafs f6\Vol2\Breakpo int\Data\Breakp ointDb.mdb", _
LinkToSource:=T rue, _
Connection:="Ta ble tblApprovedLett ers", SQLStatement:=" Select *
from [tblApprovedLett ers]"
'execute the mail merge.
objWord.MailMer ge.Destination = wdSendToPrinter
objWord.MailMer ge.Execute
'close the Word application
objWord.Applica tion.Quit
Set objWord = Nothing
Nov 12 '05 #1
2 2511
Bob Hynes wrote:
Hi All,
This code is running in WinNT/Access97. I'm looking for some help with
getting this code to do two(2) things better then it does now and I'm
not sure how to do it.
1. On the 'objWord.Applic ation.Quit' statement, it asks if I want to
save changes and I would like it to not ask that and I don't know what
the exact code is to do that.
In my code, I have an application object (word) and a document objenct (Test.doc) I
close the code with
worddoc.save
workdoc.close (false)
2. On the 'objWord.MailMe rge.Execute' statement the printer dialog
window pops up and I have to click Ok in order for it to start
printing, how do I pass the OK click to the printer dialog box? I was
thinking something like BackgroundPrint ing=OK but, again I don't know
what the exact code is.
Thanks for any and all help
bobh.


From wordhelp, thie following will print the 1st 3 pages of the doc in the active window

ActiveDocuent.P rijntOut Range:=wdPrintF romTo, Form:="1", To:="3"

You may want to subscribe to newsgroups like public.microsof t.word.vba and
public.microsof t.word.beginner s. Lost of folks there that are glad to help.
Nov 12 '05 #2
Thanks for the try put your suggestion do not work in my code. I will
however look in the Word forum.
bobh.

Salad <oi*@vinegar.co m> wrote in message news:<40******* ********@vinega r.com>...
Bob Hynes wrote:
Hi All,
This code is running in WinNT/Access97. I'm looking for some help with
getting this code to do two(2) things better then it does now and I'm
not sure how to do it.
1. On the 'objWord.Applic ation.Quit' statement, it asks if I want to
save changes and I would like it to not ask that and I don't know what
the exact code is to do that.


In my code, I have an application object (word) and a document objenct (Test.doc) I
close the code with
worddoc.save
workdoc.close (false)
2. On the 'objWord.MailMe rge.Execute' statement the printer dialog
window pops up and I have to click Ok in order for it to start
printing, how do I pass the OK click to the printer dialog box? I was
thinking something like BackgroundPrint ing=OK but, again I don't know
what the exact code is.
Thanks for any and all help
bobh.


From wordhelp, thie following will print the 1st 3 pages of the doc in the active window

ActiveDocuent.P rijntOut Range:=wdPrintF romTo, Form:="1", To:="3"

You may want to subscribe to newsgroups like public.microsof t.word.vba and
public.microsof t.word.beginner s. Lost of folks there that are glad to help.

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12522
by: Steve M | last post by:
I'm trying to do invoke the mail merge functionality of MS Word from a Python script. The situation is that I have a template Word document, and a record that I've generated in Python, and I want to output a new Word .doc file with the template filled in with the record I've generated. (To refresh your memory, in Word a mailmerge is achieved by a) under Tools -> Letters and Mailings, check off Show Mail Merge Toolbar; b) open a document...
2
3250
by: William Wisnieski | last post by:
Hi Everyone, Access 2000 I have some code behind a button that performs a word merge with a query data source. The merge works fine. But what I'd like to do somehow is after the merge is generated (or before), assign the current date to the field in the main table the query data source is based on. Is this even possible? If so, how could I do it? Here is the code that works so far:
2
3248
by: Aaron | last post by:
hello, i am perfoming a mail merge with the following code. Public Function MergeIt() Dim objWord As Object Set objWord = GetObject("C:\MyMerge.doc", "Word.Document") ' Make Word visible. objWord.Application.Visible = True ' Set the mail merge data source as the db3 database.
1
3133
by: Lisa | last post by:
I have a query named QryDept where one of the fields is DeptID. The query is used for the data source of a mail merge letter. I would like to control which department is to get the mail merge letters. I have a department selection pop-up form where the departments are listed in a listbox. The value of the listbox is DepartmentID. On the form is a Create Mail Merge button which is coded to open the mail merge and make the pop-up form not...
8
9523
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for each person for whom a mail merge letter is desired. The query reads address info from the table for each record where is true.
9
4324
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access application as the data source, and then performs a merge. Everything works fine. However, when a user uses it in Access 2002 and Word 2002, an extra instance of the Access application is opened and remains open at the end. Sometimes it remains open
3
5507
by: ljungers | last post by:
I need to make some changes to a Query/select/print report using word application. What I need to do is change the way Word is called yet keep the process the same. Word is used so changes can be made before actual printing. Need some way of calling Word as a mail merge with the information from an Access table that the current report uses. I have seen mail merge templates that use something like <<field name>> in them that uses a table....
7
4166
by: =?Utf-8?B?QmFkaXM=?= | last post by:
Hi, I'm trying to follow a mail merging example in C#.Net that I got from: http://support.microsoft.com/default.aspx/kb/301659 and in one the methods: Word.Application wrdApp; Word._Document wrdDoc; Object oMissing = System.Reflection.Missing.Value; Object oFalse = false;
0
993
by: truptidalia | last post by:
Hi, I am not that experienced in VB.NET. I am working on a application where i have to perform mail merge from the application. The application lets the userwrite letters, save them as rtf file. In letter, tags are added programmatically for fields to add data while merging. User can use the letter later to perform mail merge on it to selected customers. Customers dataset is ready. Now, can any one assist me how to move further to...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9906
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9737
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.