Solved

Printing to a Word Document

Posted on 2002-04-05
8
205 Views
Last Modified: 2010-05-02
This application does a lot of computation of X/Y coordinates, and generates a printed page.  The page is rather complicated, with a lot of graphics and a lot of .CurrentX .CurrentY followed by bits and pieces of text.  Right now, the program does all this directly to the Printer object.

Problem:  How to send this layout as an attachment to an e-mail message.

(1) Print-to-file does not work, since I don't know the printer at the receive end.

(2) Print-to-form then Printing the form results in too much loss of detail.

(3) I could generate a Postscript file (I've done this in the past).

(4) I could generate a pdf file, but it costs too much to buy the Acrobat writer.

(5) So: It occurred to me that perhaps I could print to a Word document, then e-mail that.

How do I "print to a Word document" in the same manner as printing to the Print object? -- Norm
0
Comment
Question by:posnorm
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 100 total points
ID: 6922336
Why don't you use a richtextbox control and save the contents to .rtf file.
That control has a built-in method to save the file.
0
 
LVL 1

Expert Comment

by:justinhemphill
ID: 6922799
You can use the Microsoft Word Object Library directly in your VB code.  To do this add a reference from the menu.

Then just create a new instance of this.

To see what code to write, just open up word and record a new macro.  Then do some stuff and go back in to edit the macro and it will show you the code that is required in VB to do the same thing.
0
 

Author Comment

by:posnorm
ID: 6922964
Many thanks to both replies.
I'll be sure and get back with my remarks.
I'm always glad to learn something.
-- Norm
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6923112
justinhemphill, how i didn't think that way!!!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 18

Expert Comment

by:mdougan
ID: 6929559
One other option you didn't mention is that you can print to a Picturebox using just about exactly the same code as you have been using to print to the printer object, and then use the SavePicture function to save it out as a .BMP file.  You could then attach this to an e-mail or new word document if you wish.

Just a couple of things, make sure that the picturebox's AutoRedraw property is set to True, and, if you are using graphics functions like PSet or LineTo, then I think that you have to do something like:

Picture1.Picture = Picture1.Image
SavePicture(.......)

As the graphics are drawn into the Image layer of the picturebox, not the picture property (at least I seem to remember something about this)
0
 
LVL 1

Expert Comment

by:justinhemphill
ID: 6931949
One slight problem with this approach is that you will lose a lot of quality.  Everything will look very blocky when printed at the other end.  It is basically the same as using print screen key and pasting into MS Paint.
0
 

Author Comment

by:posnorm
ID: 6935952
Thank you both for your interest in this problem.
Actually, the primary issue is this, which I am going to re-submit as another question:

A publisher has been scanning the printed page output of my program into Microsoft Publisher.  She would prefer it if I sent her a file she could simply import.

I'm going to research this.  As I said, I'll probably post another question along these lines.

Thanks to both of you again.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6936755
Hi, why didn't you use justinhemphill's comment?
By the way, why did you punish me with "B" grade?
Cheers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 55
Prevent checkbox click event occur while editing it in vb6 8 33
Added a column screws up code 5 50
Child Form in front 4 38
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now