Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing to a Word Document

Posted on 2002-04-05
8
Medium Priority
?
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 300 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6923112
justinhemphill, how i didn't think that way!!!
0
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

730 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