Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CommonDialog Cancel Button

Posted on 1998-10-14
2
Medium Priority
?
459 Views
Last Modified: 2008-03-06
OK, I'm sure its easy but I'm having trouble being able to tell if the user has pressed the Cancel button in the Printer Commondialog box.
Thanks,
Mike
0
Comment
Question by:qdsinc
2 Comments
 
LVL 4

Accepted Solution

by:
mcix earned 150 total points
ID: 1439964
Try this code:

Private Sub cmdPrint_Click()
   
    On Error GoTo err_cmdPrint_Click
    cdlgPrint.CancelError = True
    cdlgPrint.ShowPrinter
   
exit_cmdPrint_Click:
    Exit Sub
err_cmdPrint_Click:
   
        Select Case Err.Number
       
            Case cdlCancel
                MsgBox "User Cancelled"
                Resume exit_cmdPrint_Click
            Case Else
                MsgBox Err.Number & " - " & Err.Description, vbInformation, "An unexpected error"
                Resume exit_cmdPrint_Click
        End Select
Exit Sub

0
 

Author Comment

by:qdsinc
ID: 1439965
It worked, thanks alot.

Mike
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

876 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