Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Preview

Status
Not open for further replies.

beck

Programmer
Mar 22, 1999
26
0
0
US
I have created a series of forms where the user would place numerical answers to a series of questions and then calculate the results. I currently have a screen shot print routine but would like to be able to send for a print preview so that the user can manipulate the information add text and then send to the printer or copy to the clipboard. Any assistance would be appreciated. <p> <br><a href=mailto:accrec@intergrafix.net>accrec@intergrafix.net</a><br><a href= > </a><br>
 
beck<br>
<br>
It may be crude, but I format a string for each print line<br>
and call a routine to either print the line or output it to a file if the user has checked a 'print to screen' option button. The program will perform something like the following when the report is done:<br>
<br>
If checkspool.Value = 1 Then ' if print-to-screen button<br>
Close #1<br>
prspool.Show vbModal 'call a rich text box form<br>
DoEvents<br>
Else<br>
Printer.EndDoc<br>
End If<br>
<br>
'--rich text box called to display printlines saved to file<br>
'-- rich text box 'width' must be &gt; 'scale width' property<br>
Private Sub Form_Load()<br>
<br>
prspool.WindowState = 2 'maximize form at run time<br>
<br>
<br>
textfile.SelFontName = &quot;courier new&quot;<br>
textfile.SelFontSize = 8<br>
On Error GoTo TooBig<br>
textfile.LoadFile App.Path & &quot;\prspool.txt&quot;, rtfText<br>
<br>
CleanUp:<br>
<br>
Exit Sub<br>
TooBig: 'error handler displays message<br>
MsgBox (&quot;The specified file is too large.&quot;)<br>
Resume CleanUp: 'then jumps to CleanUp routine<br>
End Sub<br>
<br>
Private Sub Form_Unload(Cancel As Integer)<br>
textfile.text = &quot;&quot;<br>
DoEvents<br>
Unload Me<br>
End Sub<br>
<br>
'---note-----<br>
'---this code is used in the main program as each print<br>
'---line is created<br>
Public Sub prmode()<br>
<br>
If checkspool.Value = 1 Then<br>
Print #1, RTrim(printline)<br>
Else: Printer.Print printline<br>
End If<br>
printline = &quot; &quot;<br>
End Sub<br>
<br>

 
Thank you for your assistance. I have approximately 350 individual forms that this would be applied too. I will most certainly give it a try and see how it works. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top