Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default question regarding Visible Propery

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default question regarding Visible Propery

Forgot to tell you this. If you step thru your code (using F8 button) you
will see your code stops at Userform1.Show. Because it stops at .Show, your
If...Then statement isn't executed until you close the userform. What is
happening is when you close your userform the remainder of your code runs and
the userform remains loaded into memory. Thats why you see your code running
correctly the second time you open the userform.
--
Cheers,
Ryan


"Ryan H" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
returning comments propery of a closed file Robert Flanagan Excel Programming 2 October 22nd 09 02:12 AM
Forms Combo Box Invalid Propery Error Dave[_52_] Excel Programming 0 August 10th 05 08:49 PM
Changing the locked propery of merged cells. The Wonder Thing[_3_] Excel Programming 1 October 26th 04 09:08 PM
Print Area propery Marc Excel Programming 1 January 14th 04 03:49 AM
Listbox Propery code Mike Fogleman Excel Programming 3 January 1st 04 04:27 PM


All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"