Selecting a Printer for Mailmerge in ASP.NET

  • Thread starter michael.esposito
  • Start date
M

michael.esposito

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()
 
B

billmiami2

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
 
M

michael.esposito

I tried to do this, but its not an option for the application.

Thanks though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top