×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CommonDialog1.ShowPrinter Help

CommonDialog1.ShowPrinter Help

CommonDialog1.ShowPrinter Help

(OP)
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   
   ' Put code here to send data to your printer.
   Next
   Exit Sub
ErrHandler:
   ' User pressed Cancel button.
   Exit Sub
End Sub
Thank You in advance!!

RE: CommonDialog1.ShowPrinter Help

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
http://virtualpipeline.spaces.live.com/

RE: CommonDialog1.ShowPrinter Help

(OP)
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 ?

RE: CommonDialog1.ShowPrinter Help

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
http://virtualpipeline.spaces.live.com/

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources