Solved

CommonDialog Open file

Posted on 2004-04-05
3
962 Views
Last Modified: 2010-08-05
How do you know if they have pressed cancel?
or closed the box?

Thanx in advance
0
Comment
Question by:intalex
  • 2
3 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10756547
just do this...very simple

commondialog1.showopen
if commondialog1.filename = "" then
 msgbox "You pressed cancel!"
else
 msgbox "You picked: " & commondialog1.filename
end if


simple as that
-brian
0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10756554
the only condition in which Commondialog1.filename = "" is when the user presses cancel, so simply check to see if its empty will let you know if the user hit cancel.


-Brian
0
 
LVL 1

Accepted Solution

by:
burnttime earned 20 total points
ID: 10756644
If you have the commondialog on another form and when you press cancel the result still comes up as the opened path so when you press cancel the result isnt blank renew the ocx i had a problem with that a while back and for some reason that work???

If not just:

CommonDialog.Showopen
If CommonDialog.Filename <> "" Then
' Code here to do what ever with the directory
Else: ' Maybe message box saying error if you need a path
End if
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

Suggested Solutions

Title # Comments Views Activity
Excel - Save a copy of work book 13 83
Copy a row 12 59
Add a task in Outlook from access 11 35
Excel VBA - Run Time error '1004' Application-defined or object-defined error 4 27
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

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

16 Experts available now in Live!

Get 1:1 Help Now