How to print n save in vb using windows messange box

Now i am using common dialog box to print n save my project in vb, however it  can't work, so how can i save n print in vb just like what i do in microsoft. Pls send me your souce code.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the printer object.
 Printer.print "yefam"
Im sorry that I cannot send the complete code, coz it has to be kept confidential. Anyhow..if you have further doubts regarding using the printer object I'll guide you.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
yefamAuthor Commented:
Dear sir,
         I already set up a printer message box as what we can see in windows by , however the message box can't work. How can i activate it? ( what i want is not only to print but select something first such as paper size before print.)
Did you try 'commondialog1.showprinter?
If you are using an MDI form, you can call the above by putting it in a menu click event or if you want it in every form, you can put it in a command button's click event. In that you could get everything what you ask for(like setting the paper size(eg. A4, lettersize, legal, Fanfold, custom etc), you can even set the landscape and portrait modes.

Hope this is what you were asking for?
i already try it . it show the messange box but can not run. Why?
yefamAuthor Commented:
Dear sir,
     my source code as below:

Private Sub mnPrint_Click()
Dim ocancel As Boolean
Dim ncopy As Integer
On Error GoTo errorhandler
ocancel = False
CommonDialog1.Flags = &H20& Or &H10 Or &H4& Or &H8&
CommonDialog1.CancelError = True
CommonDialog1.PrinterDefault = True
CommonDialog1.Copies = 1
If ocancel = False Then
    For ncopy = 1 To CommonDialog1.Copies
    Next ncopy
End If
Exit Sub
    If Err.Number = cdlCancel Then
        ocancel = True
        Resume Next
    End If
End Sub

     Can you tell me what is the problem? Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.