Solved

CommonDialog Cancel Button

Posted on 1998-10-14
2
441 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
mcix earned 50 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

617 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