View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default 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