Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock userform for editing
Is there a way to SHOW a userform as Read Only?
When the userform is initialized, its textboxes and checkboxes are already populated with data from a worksheet. I don't want the users to change or edit this data. I only want them to view it. Is it possible to lock the form for editing? excel 2003 tendresse |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock userform for editing
Hi
You have to set the Enabled Property to False. With the code below only CommandButton1 will be active on the form. Private Sub UserForm_Initialize() For Each fi In Me.Controls If fi.Name < "CommandButton1" Then fi.Enabled = False End If Next End Sub Hopes this helps. --- Per "Tendresse" skrev i meddelelsen ... Is there a way to SHOW a userform as Read Only? When the userform is initialized, its textboxes and checkboxes are already populated with data from a worksheet. I don't want the users to change or edit this data. I only want them to view it. Is it possible to lock the form for editing? excel 2003 tendresse |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock userform for editing
As Per suggests the normal way is to set the enabled property to false. This
leaves them greyed, which conforms to conventions to indicate user cannot change the control. If you do not want the greyed effect you can immediately exit controls, eg Put at least two Commandbuttons on a form, a Textbox and a Checkbox. Run the form and try and change the textbox & checkbox 'userform code Private mbExitFocus As Boolean Private Sub CheckBox1_Enter() If mbExitFocus Then Me.CommandButton1.SetFocus End Sub Private Sub TextBox1_Enter() If mbExitFocus Then Me.CommandButton1.SetFocus End Sub Private Sub UserForm_Initialize() mbExitFocus = True CommandButton1.Left = -100 ' hide it End Sub Regards, Peter T "Tendresse" wrote in message ... Is there a way to SHOW a userform as Read Only? When the userform is initialized, its textboxes and checkboxes are already populated with data from a worksheet. I don't want the users to change or edit this data. I only want them to view it. Is it possible to lock the form for editing? excel 2003 tendresse |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy cells but lock editing | Excel Discussion (Misc queries) | |||
lock for editing | Excel Discussion (Misc queries) | |||
lock for editing | Excel Discussion (Misc queries) | |||
How do I lock some fields but allow editing for others in excel | Excel Discussion (Misc queries) | |||
Lock Header Rows from Editing | Excel Programming |