473,324 Members | 2,313 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,324 software developers and data experts.

How to send word file to Default printer?

word.Application msword = new word.Application();
object missing = Type.Missing;
// Hidden Word document
msword.Visible = false;

try
{
word.Document doc = LinqTool.WordCreateDocument(ref
msword);

LinqTool.WordInsertText(ref doc, pw.ToString());

object pages = "1";
object copies = "1";
object range = word.WdPrintOutRange.wdPrintCurrentPage;
object items = word.WdPrintOutItem.wdPrintDocumentContent;
object pageType = word.WdPrintOutPages.wdPrintAllPages;

object oTrue = true;
object oFalse = false;
doc.PrintOut(
ref oTrue, ref oFalse, ref range, ref missing, ref missing, ref missing,
ref items, ref copies, ref pages, ref pageType, ref oFalse, ref oTrue,
ref missing, ref oFalse, ref missing, ref missing, ref missing, ref
missing);
}
catch (Exception ex)
{
MessageBox.Show("Design Report could not be
saved\r\n\r\n" + ex.Message, "Save Error");
}
finally
{ // Always Close the Word document
object saveChanges = (object)false;

msword.Quit(ref saveChanges, ref missing, ref missing);
}
With this code I try to print pw.string() to a default printer
I can with my code save to a file by use my WordCreateDocument and
WordInsertText(..) but I don't get my Default Printer --
Kim S.
Aug 4 '08 #1
0 2577

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

Similar topics

1
by: Stephen Barrett | last post by:
I am doing word automation with Word 2003. Everything works great except for one thing. When I set the word object's ActivePrinter to a different printer, it changes the system default. I looked...
5
by: ipswich67 | last post by:
Our win forms application generates printed output that is built dynamically from images and data queries then written to a graphics object for printing, however I also need to be able to save the...
1
by: Nicole | last post by:
Like many before me, I am tearing my hair out trying to get Acrobat 6.0 to work with VBA. I am getting close, and the error I am getting now seems like it should be easy to surmount. So why am I...
3
by: RC | last post by:
I am using docmd.printout to send Reports (formatted as labels) to a barcode label printer. I need to collate the labels so that I print lable 1 twice, then label 2 twice, then label 3 twice, etc....
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
3
by: Bob | last post by:
Hi, Win2kServer Platform I dusted off some fax sending code that used to work. The send is now returning 'The date is invalid. System.Runtime.InteropServices.COMException(0x8007000D): The data...
2
by: Vivek | last post by:
Hi, I have an application that writes to a word document. After that I wish to print the document to a particular printer automatically. I tried but it keeps on printing to the default...
13
by: Susan Beebe | last post by:
I have downloaded the code described in Microsoft article Q154078. I am trying to send raw ZPL (zebra barcode printer) code from Microsoft access. It works just fine if I hard code the actual...
1
by: remya1000 | last post by:
how to send a .txt file to a printer. after creating a .txt file i need to send that .txt file to a printer.using vb.net and while sending that file to printer i need to tell, which printer i need...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.