473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Selecting a Printer for Mailmerge in ASP.NET

I am using the code below to create a document through mailmerge and
then print it. It is running through ASP.Net, which automatically uses
the default printer for the server. I want to be able to have the user
select which printer to use before the process begins....is there any
way I can do this?

Please let me know if you have any ideas!! Thanks!!!

Michael

wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False

wrdDoc = wrdApp.Documents.Add(doc_path)
wrdDoc.Select()

wrdSelection = wrdApp.Selection()
wrdMailMerge = wrdDoc.MailMerge()

wrdDoc.MailMerge.OpenDataSource(ds_path)

wrdMailMerge.Destination =
Word.WdMailMergeDestination.wdSendToPrinter

wrdMailMerge.Execute(True)

wrdDoc.SaveAs(doc_path)
wrdDoc.Close()

Nov 19 '05 #1
2 1067
Michael,

It's probably not a good idea to open MS Word on the server like that.
I would think that you would bog down the server, especially if
multiple users were forcing the application to open simultaneous
instances of word.

An approach that I have taken is to generate a comma-delimited text
file from the web application and store it on the server. The user is
then directed to open a MS Word document which is set up for a mail
merge as you have already done. When the user opens the document,
he/she is prompted to enter a username. From that point, code in the
document sets the mail merge source to the appropriate csv file
previously created on the server. In this way, you have Word running
on the client rather than the server and the print settings can be user
configured.

Bill E.
Hollywood, FL

Nov 19 '05 #2
I tried to do this, but its not an option for the application.

Thanks though.

Nov 19 '05 #3

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

Similar topics

5
by: Maurice Mertens | last post by:
Hi all, having troubles with printing a crystal reports report to a specific tray in a printer. By means of System.Drawing.Printing.PrinterSettings.PaperSources it's possible to find out how...
2
by: Shannon Rotz | last post by:
I have a function in a Microsoft Access module (below) which creates a Word XP Mailmerge document, drawing the data from Access XP. I can get the connection to work fine. However, when I create...
4
by: Ray Todd Jr | last post by:
I can't get ths code to correctly execute. After I have clicked on a Access Form, I want the code to open the word document, merge the data, print the forms and then close the two windows that...
0
by: RH | last post by:
Hi, I'm trying to use mailmerge with Word2003 from an asp.net webpage I'm using the following code: Dim W As New Word.Application Dim D As Word.Document = W.Documents.Open("maindoc.doc")...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
0
by: Anne Richmond | last post by:
I have a Word(2000) mailmerge routine (code below) which works OK but always names the merged document "Forml Letters1". How do I change this to something else? Also how do I automatically save...
0
by: Bob Smith | last post by:
I have existing word documents that we need to have the data document reflect whether we're running in development, test or production. The data header is longer than 255 characters, so I cannot...
0
by: BerkshireGuy | last post by:
This code, opens a mail merge and prints to my default printer. How can I modify this code to print to a specific printer on the network and a particular printer tray? Dim WordObj As...
0
by: bobh | last post by:
Hi All, I have this older code(see below) that I used for a mailmerge in another application, I'm looking to do something similar but a little different in that, this time I have a single record...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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
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...

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.