Solved

CommonDialog Open file

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

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

Title # Comments Views Activity
How to create a duplicate finder Application 9 122
MsgBox 2 59
how to know if my Checkbox is True in VB6.0? 9 60
Powerpoint 2013: Change cell reference in excel link 3 84
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

828 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