Solved

CommonDialog Open file

Posted on 2004-04-05
3
974 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
[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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…

734 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