I need to use checkbox(or similar symbol) to notify some steps had been completed. But when use checkbox, the ueser can click to modify it or change it. So I want to fulfill unchangeable checkboxes or similar symbol, so how to do it?
Printable View
I need to use checkbox(or similar symbol) to notify some steps had been completed. But when use checkbox, the ueser can click to modify it or change it. So I want to fulfill unchangeable checkboxes or similar symbol, so how to do it?
Where is this checkbox located (worksheet, UserForm)?
If it is on a worksheet is it Forms control or an ActiveX control?
The simplest way is to set the CheckBox control's Enabled property to false. However that makes the control aesthetically unappealing.
The only option I know of is to constrain the value from changing when it is clicked. Use the control's Tag property to store the desired value and handle the Click event.
Code:Private Sub UserForm_Initialize()
SetCheckBox CheckBox1, False
End Sub
Private Sub CheckBox1_Click()
RestrainCheckBoxValue CheckBox1
End Sub
Private Sub RestrainCheckBoxValue(cb As MSForms.CheckBox)
If cb.value <> cb.Tag Then cb.value = cb.Tag
End Sub
Private Sub SetCheckBox(cb As MSForms.CheckBox, value As Boolean)
' use this method to programatically change the CaheckBox Value
' changing the MSForms.CheckBox.Value property from True to False or False to True
' invokes the MSForms.CheckBox.Click event, so set then Tag property 1st
cb.Tag = value
cb.value = value
End Sub
Thank you. Actually we hope to use a small symbol or picture to notify the user that this step had been completed. This symbol or picture like a checkbox but can not been modify. So I just do not know how to find a symbol or picture looks like a checkbox...
I would think that searching for an image wouldn't be that hard, but I haven't tried it yet.
Worse case (I guess), would be just put a checkbox on a form, start the program and check the checkbox.
Then hit Alt-Print Screen to screen capture the window.
Open up Paint, and Ctr-V to paste the captured window into paint.
Choose the Select option from the toolbar, drag a selection box around the checkbox, and select the Crop option.
You should now have a small image of a checked checkbox, which you can save (I usually let it default to .png file).
p.s. I just did a search on "checkbox image", and saw a number of images that could be used. One example page.
I would think that an image control would work... then you just load a checkmark image into it... that's how we do it.
-tg
checkbox controls have a locked property, this will prevent the user from clicking, the value can still be changed by code