Wow, thank you Jonathan and Tabasco Ed for the helpful replies.
I'm just wondering, is there a way to "dynamically" create labels in the
form. For example, the number of results will vary depending on the search
and can't be determined before run-time.
Cheers!
> Wow, thank you Jonathan and Tabasco Ed for the helpful replies.
>
> I'm just wondering, is there a way to "dynamically" create labels in the
> form. For example, the number of results will vary depending on the search
> and can't be determined before run-time.
Yes, you can dynamically create labels, but you can't dynamically create
clickable hyperlinked labels.
What you could do is create the maximum number of labels that you think you
might need, leaving them blank, and then dynamically fill them with file
names as necessary. The click event of each label would be fixed code which
reads the Caption property in order to know which file to open.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
ffn - 05 Mar 2005 07:29 GMT
Thanks Jonathan, by the way, do you have any references where I can find out
how to dynamically create labels?
cheers.
>> Wow, thank you Jonathan and Tabasco Ed for the helpful replies.
>>
[quoted text clipped - 9 lines]
> file names as necessary. The click event of each label would be fixed code
> which reads the Caption property in order to know which file to open.
Jonathan West - 09 Mar 2005 15:57 GMT
> Thanks Jonathan, by the way, do you have any references where I can find
> out how to dynamically create labels?
You can do this by means of the Controls.Add method. Assign each label you
create by this method to an object variable (perhaps an item in an array of
Labels). You can then manipulate each label as you wish (e.g. setting Top,
Left & Caption properties)
By the way, an array of controls is not the same as a VB6 Control Array (see
today's other reply in this thread.)

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Tabasco Ed - 07 Mar 2005 21:44 GMT
>> Wow, thank you Jonathan and Tabasco Ed for the helpful replies.
>>
[quoted text clipped - 4 lines]
>Yes, you can dynamically create labels, but you can't dynamically create
>clickable hyperlinked labels.
I've never tried this in VBA, but is it possible to create a control
array like in VB6? If so, the code would already exist, you would
just add elements to the array.
>What you could do is create the maximum number of labels that you think you
>might need, leaving them blank, and then dynamically fill them with file
>names as necessary. The click event of each label would be fixed code which
>reads the Caption property in order to know which file to open.
Jonathan West - 09 Mar 2005 15:52 GMT
>>> Wow, thank you Jonathan and Tabasco Ed for the helpful replies.
>>>
[quoted text clipped - 9 lines]
> array like in VB6? If so, the code would already exist, you would
> just add elements to the array.
Unfortunately no. Control arrays are not supported in VBA UserForms.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
> Wow, thank you Jonathan and Tabasco Ed for the helpful replies.
>
> I'm just wondering, is there a way to "dynamically" create labels in the
> form. For example, the number of results will vary depending on the search
> and can't be determined before run-time.
If you think that you might have more files than can be accommodated by
means of the label solution, a further alternative would be to put all your
filenames into a listbox. The DoubleClick event of the listbox could open
the currently-selected file. Then put a label above the listbox saying
"double-click on any item to open that file"

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup