Reputation: 1671
I have the below userform and I would like to be able to show frame1
or frame2
as if they were independent.
So far, my first button show frame1
works well, but not the second one.
Any advice ?
Private Sub CommandButton1_Click()
Frame1.Visible = True
Frame2.Visible = False
End Sub
Private Sub CommandButton2_Click()
Frame1.Visible = False
Frame2.Visible = True
End Sub
Upvotes: 0
Views: 876
Reputation: 1
Sub myFrame() Dim c as control For each c in me.controls If typename(c)="Frame" then With c .height=40 .width=40 .left=0 .top=0 End with End if Next c End sub
sub Cmd1_click() Frame2.visible=false With Frame1 .visible=true .zorder msobringtofront End with End sub
Upvotes: 0
Reputation: 12279
As per my comment, the following would do what you're after - provided in normal edit mode the two frames are not within one or the other like so:
Private Sub CommandButton1_Click()
Frame1.Visible = True
Frame1.Left = 12
Frame1.Top = 12
Frame2.Visible = False
End Sub
Private Sub CommandButton2_Click()
Frame2.Visible = True
Frame2.Left = 36
Frame2.Top = 36
Frame1.Visible = False
End Sub
Just adjust the 12
and 36
values to your requirements
Upvotes: 1