View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default question regarding Visible Propery

I would try reversing your code. Load the userform first, set the control
properties, then show the userform.

Sub Uncancel_sim()

Load Userform1

If Application.UserName = "dresses" Then
Userform1.CommandButton2.Visible = False
Userform1.Frame4.Visible = False
Else
Userform1.CommandButton2.Visible = True
Userform1.Frame4.Visible = True
End If

Userform1.Show

End Sub

Hope this helps! If so, let me know click "YES" below.
--
Cheers,
Ryan


"Basta1980" wrote:

Hi,

See code below. When I open workbook, click the assigned button userform1
appears & although my username is not dresses frame4 and commandbutton2 are
shown. When I close userform1 and then reopen userform1 through the
aforementioned button frame4 and commandbutton2 are hidden (like it should).
Can anyone help me with this?



Sub Uncancel_sim()

UserForm1.Show
If Application.UserName = "dresses" Then
UserForm1.CommandButton2.Visible = False
UserForm1.Frame4.Visible = False
Else
UserForm1.CommandButton2.Visible = True
UserForm1.Frame4.Visible = True
End If

End Sub

Regards,

Basta1980