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 cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CommonDialog1.ShowPrinter Help

Status
Not open for further replies.

drewf

Mechanical
Joined
Jul 16, 2007
Messages
6
Location
US
I don't know what to put in for green text. What code do I use to send to the printer.
Code:
Private Sub Command1_Click ()
   Dim BeginPage, EndPage, NumCopies, Orientation, i
   ' Set Cancel to True.
   CommonDialog1.CancelError = True
   On Error GoTo ErrHandler
   ' Display the Print dialog box.
   CommonDialog1.ShowPrinter
   ' Get user-selected values from the dialog box.
   BeginPage   = CommonDialog1.FromPage
   EndPage       = CommonDialog1.ToPage 
   NumCopies   = CommonDialog1.Copies
   Orientation = CommonDialog1.Orientation
   For i = 1 to NumCopies   
   [COLOR=green]' Put code here to send data to your printer.[/color]
   Next
   Exit Sub
ErrHandler:
   ' User pressed Cancel button.
   Exit Sub
End Sub
Thank You in advance!!
 
printer.newpage 'start new page
printer.print "Copy Number = ";i 'prints copy number
printer.print.me 'prints the current form
'print a calculation
Printer.Print("Total (" & (19 + 300) / 4 & ")")
'prints "Total (79.75)"
printer.print "Goodby"
printer.enddoc 'dumps the page to the printer

**********************
"The problem isn't working out the equation,
its finding the answer to the real question." BigInch
 
Thank You BigInch for the code.
I diden't express my problem correctly.
I am trying to get VB to print the document I have already have open on my screen. (.doc, .xls, .dwg, .slddrw) I have the printer printing by the pages come out blank.
Any Ideas ?
 
I thought the question was too easy.

Not really. I've never had the occasion to print a document opened by VB using another application. I would suspect that you have to refer to that document in the same manner in which you opened it in VB. Maybe something like, Printer.Print Excel_whatever, but sorry, I really don't know.

**********************
"The problem isn't working out the equation,
its finding the answer to the real question." BigInch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top