View Full Version : Solved: How to handle a activeX Object?
Taipion
12-15-2009, 09:06 AM
Hello,
thanks for your time in advance. :-)
This is my first approach to help in this or any forums for VBA,
so excuse me if i missed something.
Problem:
There is a ControlObject in Access VBA that inherits a BrowseForFolder,
like the one you get when using this nice code here: (would post the link, but i cant as i have 0 posts up till now, its from these forums, so just add "/kb/getarticle.php?kb_id=284" to the url to get to the post)
But this way of doing it does not fit my needs, I need to
use the ControlObject.
Now how do I get the selected folder out of the ControlObject?
Taipion, welcome to the forum.
What eaxactly do you want to do with the Folder?
Get it's name?
Open it?
Get it's files?
Taipion
12-15-2009, 10:29 AM
I just want the path of the selected folder, thats it, but i dont know how, is it a attribute of that control or how do I get there?
CreganTur
12-15-2009, 10:43 AM
You can use the Object Browser to look at the code for that object. You can also use intellisense to expose the object's methods by typing its name and a dot (.)
Taipion
12-15-2009, 10:56 AM
I allready tried this, but there are no helpful options.
I believe the actual object that i need to access is within that control, so attributes of the control wouldnt be any useful. (?)
As I said, i am not familliar with those activeX objects.
But thanks for trying! :-)
I use this Module to get the Directory (Full Folder Path)
Dim bInfo As BROWSEINFO
Dim path As String
Dim r As Long, x As Long, pos As Integer
' Root folder = Desktop
bInfo.pidlRoot = 0&
' Title in the dialog
If IsMissing(Msg) Then
bInfo.lpszTitle = "Select a folder."
Else
bInfo.lpszTitle = Msg
End If
' Type of directory to return
bInfo.ulFlags = &H1
' Display the dialog
x = SHBrowseForFolder(bInfo)
' Parse the result
path = Space$(512)
r = SHGetPathFromIDList(ByVal x, ByVal path)
If r Then
pos = InStr(path, Chr$(0))
GetDirectory = Left(path, pos - 1)
Else
GetDirectory = ""
End If
Taipion
12-15-2009, 11:35 AM
OBP, I cant check it from here, but I guess that brings up a dialogue box.
I try to use the Control Object, that has the BrowseForFolder in it,
my only real problem is, that you can browse all you want within
that control, but i cant read out the selected folder.
Thanks allready for all these responses, you people are pretty fast. ;)
[Edit:]
I need to use the "BrowseForFolder Control" that you can use (in Access)
on a Form via "Toolbox" => "More Controls".
From my limited knowledge I do guess its a ActiveX object.
I just need to read out the folder path that is currently selected within that control.
Anyone a idea how to do that?
[Edit:]
Fixed!
Me was just stupid. :-)
There is a Event related to that control named "folder selected",
that is triggered whenever another folder is seleted.
This evente delivers the path allready.
But many thanks to you all!
Now how to i mark this thread as solved?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.