?
Solved

User Click Cancel/save  In CommonDialog control

Posted on 1998-06-23
3
Medium Priority
?
320 Views
Last Modified: 2010-05-03
how a program in vb5 knows if the user choose cancel or save in commondialog control which  Displays  the Save As dialog box.
The program is using  the Comdlg32.ocx
0
Comment
Question by:gali040898
3 Comments
 
LVL 9

Expert Comment

by:Dalin
ID: 1464039
gali,
If the OK button is clicked, Comdlg accept the user's input/selection, if cancel is clicked, the input/selection will be discarded (the fileName property will not have anything)
Regards
Dalin

0
 
LVL 7

Accepted Solution

by:
tward earned 200 total points
ID: 1464040
Do the following:

  CommonDialog1.CancelError=True

  On Error Resume Next
  CommonDialog1.ShowSave
 
  If Err.Number = cdlCancel Then
   
    Call MsgBox("User Pressed Cancel!!!")

  End If
0
 

Author Comment

by:gali040898
ID: 1464041
I want to delete the Question . I found the answer :
If Err = 32755 Then    ' User chose Cancel.
        Exit Sub
 End If

when the property CancelError = true
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

862 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