473,785 Members | 2,919 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to send word file to Default printer?

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

try
{
word.Document doc = LinqTool.WordCr eateDocument(re f
msword);

LinqTool.WordIn sertText(ref doc, pw.ToString());

object pages = "1";
object copies = "1";
object range = word.WdPrintOut Range.wdPrintCu rrentPage;
object items = word.WdPrintOut Item.wdPrintDoc umentContent;
object pageType = word.WdPrintOut Pages.wdPrintAl lPages;

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 WordCreateDocum ent and
WordInsertText( ..) but I don't get my Default Printer --
Kim S.
Aug 4 '08 #1
0 2611

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

Similar topics

1
10595
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 for help on MS site and they say it is a known issue. The work around is to use WordBasic commands like as follows. ------------------------------------ MORE INFORMATION To select a new printer without having Word change the default system...
5
1340
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 final graphics object to some sort of file that can be saved to disk, then emailed to users outside of our domain. Is it possible to stream the graphics output to a generic filetype(word, pdf, html)? Thanks in advance for any assistance.
1
6576
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 stumped?! ;) This code is in the middle of a large module in an ADP that takes web data and ports it to an MS Word form that is dynamically generated based on the data. Near the end, the Word doc needs to print to PDF and save both the Word...
3
4118
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. The printout collate option only seems to work if the printer supports it. The label printer I am using doesn't collate via the printout command option, but it does have a command language that will collate IF I can find a way to send the...
5
4042
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 think - it might have been XP) to 2003. The database is impressive, both in what it does and the obtuse and inconsistent ways it works. There are several hundred queries, for example, with no indication of where they are used or if they are in fact...
3
5574
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 is invalid as FAXCOMLIB.IFaxDoc.Send() (Code Below) I recently just installed a PCI modem card for the test. However it sends
2
4315
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 printer. How can I set the printer for the word document to print? Thanks
13
21699
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 data in the string being sent to the printer. However, if I prompt the user for data or if I insert data from a particular record/field in a form Access crashes/closes on its own. I have included the code below, if anyone has any suggestions,...
1
6009
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 to send. and i can't used printdialog, to select to which printer i need to send and number of pages and all. everything i need to hardcode. after creating a .txt file, hardcode to which printer i need to send the data and just send to printer. ...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10087
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
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
8971
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...
0
6737
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();...
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.