Common Dialog Box

S

SecretCharacter

Hi all,
I want to create a command button with the word browse.... so that when i
click it it will show out a dialg box for us to find the folder location,
when we selected the folder that we want and click ok, the folder location
will be iput in a text box. Do anyone knows how to go about doing it? Thanks
a zillion in advance. When I try to use the microsoft common dialog control
it will prompt out that this control requires a license and don't allow me
to use it.


Happy New Year to all!!!!
--Secret Character
 
N

Niklas Östrergren

Hi!

You could use this:

' Code starts here ======================================
Dim strFilePath As String
Dim strFilter As String

' strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)",
_
"*.MDA;*.MDB")
' strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
strFilter = ahtAddFilterItem(strFilter, "Excell Files (*.xls)", "*.XLS")
strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
strFilter = ahtAddFilterItem(strFilter, "Word Files (*.doc)", "*.DOC")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")

'=========================================================
' Open Dialog OpenSave and get the path for selected file
'=========================================================
strFilePath = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Select file to add...")

' Code Ends Here ==================================================

strPath will return the path to the selected file for you to save wherever
you want to.

// Niklas
 
D

Dirk Goldgar

Niklas Östrergren said:
Hi!

You could use this:

' Code starts here ======================================
Dim strFilePath As String
Dim strFilter As String

' strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda,
*.mdb)", _
"*.MDA;*.MDB")
' strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)",
"*.DBF") strFilter = ahtAddFilterItem(strFilter, "Excell Files
(*.xls)", "*.XLS") strFilter = ahtAddFilterItem(strFilter, "Text
Files (*.txt)", "*.TXT") strFilter = ahtAddFilterItem(strFilter,
"Word Files (*.doc)", "*.DOC") strFilter =
ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")

'=========================================================
' Open Dialog OpenSave and get the path for selected file
'=========================================================
strFilePath = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Select file to add...")

' Code Ends Here ==================================================

strPath will return the path to the selected file for you to save
wherever you want to.

// Niklas

I'm afraid you've left out the supporting functions that the code you
posted is calling.

Secret Character, have a look at these web pages:

www.mvps.org/access/api/api0001.htm
www.mvps.org/access/api/api0002.htm

The first is for the File Open/Save dialog; the second is for the Browse
Folder dialog.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top