1 Attachment(s)
[RESOLVED] How easily select a path
Hi,
I've already seen in VB a control in the toolbox that allow me to select a path and a file by browsing in my computer with an automatic dialog window such as the one in attachment.
But now, I don't have it on my tool box and I can't find it within the references and the additional controls.
How may I find or call this kind of dialog box ?
Thanks!
Re: How easily select a path
It is called a Common Dialog Control and can be found under Components.
Re: How easily select a path
Thanks,
I found it. But when I want to insert that control on my form, an error message ay that the control cannot be created because it is not properly licensed...
Any clue of wath I can do ?
I'm using VBA with Flexpro (a data acquisition and analysis software)
Re: How easily select a path
Quote:
Originally Posted by croto
Thanks,
I found it. But when I want to insert that control on my form, an error message ay that the control cannot be created because it is not properly licensed...
Any clue of wath I can do ?
I'm using VBA with Flexpro (a data acquisition and analysis software)
If you are using VBA, then your post should be in the Office Development section, which is where I just moved it. The reason is simple: There are a number of coding differences and responses you may get with VB6 code may not work with VBA.
In terms of the Common Dialog Control in a VBA environment, I don't know what the answer to your issue is, but I'm sure one of the folks that hang out in Office Development will. :)
Re: How easily select a path
Thanks Hack. And sorry for the inconvenience, I'm new there!
Now I wait an answer from someone here!
Re: How easily select a path
I've never used FlexPro, but VBA has a way of accessing common dialog controls in every application I've used it with.
In Excel you would use
VB Code:
Application.GetOpenFileName
In Word you would use
VB Code:
Application.Dialogs(wdDialogFileOpen).Display
I'm sure FlexPro has a similar dialog if you dig around.
Re: How easily select a path
If you r getting a license error then look at these two ms links.
http://support.microsoft.com/default...b;EN-US;194751
http://support.microsoft.com/kb/177799/EN-US/
Otherwise mikeyc1204's post is the VBA way. :)
Re: How easily select a path
Well..
There is no way to do it with mikeyc1204's method in Flexpro (I've dg a lot!) and RobDog888 link's are great but they need to have VB6.0 installed. And I don't.
I tried to post my question on Flexpro's forum... I'll wait for their answer.
Thanks again
Re: How easily select a path
If Flexpro supports MS VBA then perhaps the links will work if you add the CDL control to your toolbox after registering the .ocx only?
Re: How easily select a path
No.. I tried and there's nothing to do with that
Re: How easily select a path
Here is the reply that Flexpro's support just gave me :
Quote:
You need a design-time license for the "Common Dialog Control". This design time license comes together with VB 6.0, unfortunately not with VBA.
So if you have VB installed on your system you can use the control also in VBA. If you redistribute a VBA project which uses the control and you simply install (copy+register) the control on the target machine it will work fine at run-time. On the other hand you will not be able to add a new instance of the control on the target machine.
To get the dialog box without the "Common Dialog Control" is possible, as the functionality is provided by a Windows API. This requires some more work, see for instance
http://www.activevb.de/tipps/vb6tipps/tipp0368.html for a VB-example. This should basically work also with VBA.
I tried the Windows API thing, but it seem a lot too hard for me...
Re: How easily select a path
Oh, we have examples of it on the forums too. Its not hard at all. Place it in a module and just call from anywhere.
Re: How easily select a path
Here's something I posted a while ago...
VB Code:
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)
With dlgOpen
.AllowMultiSelect = True
.Show
End With
For Each i in dlgopen.selecteditems
'Insert your code here - changing the filenames to "i"
Next i
from this thread.
HTH
zaza