Solved

User Click Cancel/save  In CommonDialog control

Posted on 1998-06-23
3
252 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now