Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling the Common Dialogues using visual basic

Status
Not open for further replies.

Taha60

Technical User
Jun 21, 2002
54
CA
Hello....

I wanted to be able to call the common select folder Dialogue box from an access application form... However it asked me to use Office developers edition.

I have Visual basic 6 and I wonder if I can use that to somehow get the ability to use the API?

If not ... how else Can I get access to the Common Folder select API / module


Thanks

Taha
thamiral@uwo.ca
 
What is!!

the "common select folder Dialogue box", what is it supposed to do. please clarify.
 
Hello...zevw

The common select folder Dialogue box is like the &quot;open dialogue box&quot; that comes standard with windows and can be invoked by any app. Therefore instead of writing your own File --> open you would just create insert an ACTIVEX control called &quot;Microsoft windows common controls&quot; <comctl32.osx> and you have a standard open file dialogue that you can use.

With the &quot;select folder dialogue box&quot; you can select folders instead of files.

Hope this helps...

Thanks in advance Taha
thamiral@uwo.ca
 
I was looking for something else!!

But I made a keyword search and found exactly your question

here is the link

thread705-38964
 
I found something better when making a Keyword Search for Dialog Box

Go to!!

thread705-74074
 
Thanks for the info... However I would like to find out how to bring up the windows common Dialogue box that will allow the user to select the folder and then when he/she clicks &quot;OK&quot; then it returns the path of the folder chosen...
What the link that you provided me describes is how to do it for a SINGLE FILE... It also requires the developers edition to use that api... :(

Thanks anyway ... it was a useful revision for me since I will need the &quot;open file dialogue box&quot; sometime...

Thank you. Taha
thamiral@uwo.ca
 
I have found a solution at Compacted it looks like this:
'32-bit API declarations
Declare Function SHGetPathFromIDList Lib &quot;shell32.dll&quot; _
Alias &quot;SHGetPathFromIDListA&quot; (ByVal pidl As Long, ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib &quot;shell32.dll&quot; _
Alias &quot;SHBrowseForFolderA&quot; (lpBrowseInfo As BROWSEINFO) As Long

Public Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Function GetDirectory(Optional msg) As String
' displays a explorer tree dialog box and returns the selected path
' displays msg or defaulttitle as box title
' found in and slightly modified

Dim bInfo As BROWSEINFO
Dim path As String
Dim R As Long, x As Long
Const defaulttitle = &quot;Select a Folder&quot;

bInfo.pidlRoot = 0& ' root folder = desktop
If IsMissing(msg) Then msg = defaulttitle ' default title if no argument
bInfo.lpszTitle = msg ' set title
bInfo.ulFlags = &H1 ' type of directory to return
x = SHBrowseForFolder(bInfo) ' display the dialog
path = Space$(512) ' Parse the result
R = SHGetPathFromIDList(ByVal x, ByVal path) ' get result string
GetDirectory = &quot;&quot; ' set default result (if error)
If R Then GetDirectory = Left(path, InStr(path, Chr$(0)) - 1) ' set result (if no error)

End Function

More explanations to the functions used you can find in
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top