select objects in vba

spinkung

Registered User.
Local time
Today, 23:11
Joined
Dec 4, 2006
Messages
267
Hi

i have some form object which sit on top of each other. I have brought them in and out of view by grouping them using tags.

what i want to be able to do is select a bunch of items with a tag name and select them all (so i can move/format them).

i though something like ..

Code:
Dim ctl As Control

For Each ctl In Form_frm_selections.Controls
    If ctl.Tag = "tag_prods" Then
        ctl.[COLOR="Red"]select[/COLOR]
    End If
Next

...would do it but i can;t find a select object method.

anyone?

Thanks
 
If you are wanting to "move/format" all of the controls that have a specific tag then your idea will work except you would just need to change/modify the appropriate properties of the controls like: Top, Left, Width, Height, etc. You can also do the formatting an apply it to all but you would not need to "select" them, just address the appropriate property.

Something like:
Code:
Dim ctl As Control  For Each ctl In Form_frm_selections.Controls     If ctl.Tag = "tag_prods" Then         with ctl
            .[COLOR=black]visible = true[/COLOR]
            .top = 200
            .left = 1200
        end with      
     End If Next
 
thanks for the reply. i was hoping to be able to select everything and then move all the items to keep the layout. If i have to use top, left etc... then it'll take forever to move then re-align all the objects.

doesn't look like it's possible. :banghead:
 
is it possible to return the top/left position of an object. i might be able to get this to work if i had those?

Thanks
 
The location properties are located on the Format tab of the properties sheet. The values shown are the current values. You can simply change these values to reposition any object. The value shown are in "twips". To get the details about what the values you will see there, just press F1 and take a look at the Help.
 

Users who are viewing this thread

Back
Top Bottom