Change visible true/false of controls

K

kalle

Hello

I use this code to change visible true/false of some controls in my
workbook. I get SheetName, ShapeName and true/false (0 or -1) from a
database.
I do this to create user levels

Sheets(SheetName(i)).Shapes(ShapeName(ii)).Visible = -1

This works well but now I want to also access controles is in userform.
I also want to change caption on the controls if it's possible.

Excuse my bad English but I hope you understand the question anyway

Thanks in advance

*** Sent via Developersdex http://www.developersdex.com ***
 
P

Peter T

What type of Control, ActiveX (control Toolbox) or Forms. Also what is it,
eg checkbox.

Regards,
Peter T
 
P

Peter T

Dim oleObj As OLEObject

Set oleObj = Worksheets("Sheet1").OLEObjects("CheckBox1")

oleObj.Visible = True ' or False
oleObj.Object.Caption = "New Caption"

Similar for the commndbutton

Regards,
Peter T
 
P

Peter T

Dim img As MSForms.Image ' or simply As Control

Set img = Me.Controls("Image1")
img.Picture = LoadPicture(sFile)


Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top