Link to home
Start Free TrialLog in
Avatar of bravismore
bravismore

asked on

Common Dialog Box

Is it possible to use the windows Dialog Box, the one which loads when someone tries to open a file,  using VB for Access?
Avatar of James Elliott
James Elliott
Flag of United Kingdom of Great Britain and Northern Ireland image

You can open it, Yes.

I'm not sure whether you can use it as a shell for your own devices.

Is that what you are asking?

ASKER CERTIFIED SOLUTION
Avatar of cquinn
cquinn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I stand corrected.

Hi Bravismore,

-add the common dialog activeX control to your form.
-give it a name like "ofdFile" needed to refer to in code
-in your form code to open the Common Dialog box you could use code similar to the following

dim strFile as string

'Show Open File Common Dialog Control
Me!ofdFile.DialogTitle = "TITLE"
Me!ofdFile.Filter = "Excel Files (*.xls)|*.xls"
' next line can be any default path like "C:\My Documents"
Me!ofdFile.InitDir = "C:\"
Me!ofdFile.ShowOpen
' to get the filename in a variable
strFile = Me!ofdFile.FileName

:O)Bruintje
Avatar of bravismore
bravismore

ASKER

Thanks for the prompt response

Will get back to u in a moment.
Hi cquinn

Dim clCDl As New clsCommonDialog
@compile time: It's complaining that a "Module is not a valid type"

Help pliz!
Hi cquinn

I am failing to rename the class module I created

Its just named automatically to class1
Sorry cquinn

It worked! Thanks!
Hi cquinn, jell

I have managed to use the dialog box
How can I tape the file handler so that instead of opening the file I use it as input to my own program


And also how can I use the same facility to save files.
How can I limit files which show up to only those with a specified extension(like *.ins).
how can I add a default file extension
Under Project >> Compontents, select "Microsoft Common Dialog Control 6.0 (SP3)" which will put a new tool on your toolbar, then put that tool onto your form and in the properties box, select "custom" and a window will open up that lets you set a file filter such as "*.ins".

You'll have to add code like (assumes you've named the common dialog "cdlgPath"):

cdlgPath.ShowOpen    ' opens the dialog box

filename = cdlgPath.FileName   ' gets the selected file name

I don't know that this will do everything that all of the code provided by cquinn will do, but it sure is a lot simpler.
that's essentially what i already added here but gt no reaction on that

:O)Bruintje
Thanks

Will get back to u asap!
Bruintje --- yep, I missed your comment; got swamped by the length of the thread

bravismore --- you've got two of us now telling you exactly the same thing; probably be a good idea to check it out.
Greetings,

This question is current, others below are not.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.20286990.html
https://www.experts-exchange.com/questions/Q.20286911.html
https://www.experts-exchange.com/questions/Q.20289019.html
https://www.experts-exchange.com/questions/Q.20290115.html
https://www.experts-exchange.com/questions/Q.20291339.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
https://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
Hi Moondancer, IF the asker doesn't respond

Q. was if and how to use the file open dialog
A. is the long post from cquinn

bravismore to cquinn > It worked! Thanks!

So i would simply say PAQ and points to cquinn

:O)Bruintje
Thank you very much.

Finalized today.

Moondancer - EE Moderator