Help!

Multipage

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> User Forms RSS
Next:  Outlook 2007  
Author Message
Kiwi User
External


Since: Feb 09, 2006
Posts: 7



PostPosted: Mon Jul 06, 2009 5:31 pm    Post subject: Multipage
Archived from groups: microsoft>public>word>vba>userforms (more info?)

Hi,

I have a form that I have completed with radio buttons, which, when selected
shows a different set of fields for the user.

I know how to make a frame visible, but the problem I see with this is the
"space" two separate frames make when only one is chosen.

I decided upon a multipage layout with the style as fmTabStyleNone so it
looks seemless.

The problem I am having is getting the correct (actually, any!) multipage
layout to appear on selection of the radio button. So far I have:

_______
hides the frame which surrounds the multipage until radio is selected
_______

Public Sub UserForm_Initialize()

TabsFrame.Visible = False


End Sub


_______
I copied this from the help file but can't get it to work Sad Error
message is Invalid class string
_______
Private Sub TOption1_Click()
Tabs.Visible = True

Dim TabIndividual As Control

If TOption1 = True Then
Set TabIndividual = TabsFrame.Pages(0).Controls.Add("frmMain" _
& ".TextBox.1", "TabIndividual", Visible)


End If

End Sub

Private Sub TOption2_Click()
Tabs.Visible = True

Dim TabCompany As Control

If TOption2 = True Then
Set TabCompany = TabsFrame.Pages(0).Controls.Add("frmMain" _
& ".TextBox.1", "TabCompany", Visible)


End If

End Sub




Thanks in advance!!
Back to top
Doug Robbins - Word MVP
External


Since: Jul 14, 2006
Posts: 2665



PostPosted: Tue Jul 07, 2009 12:10 am    Post subject: Re: Multipage [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I would just put all of the controls on the one form and assign a tag name
to each control in each group (e.g. use Company for the company controls and
Individual for the individual controls) and then use the following code for
the Option buttons:

Private Sub OptionButton1_Click()
Dim acontrol As Control
For Each acontrol In Me.Controls
With acontrol
If .Tag = "Company" Then
.Visible = True
ElseIf .Tag = "Individual" Then
.Visible = False
End If
End With
Next acontrol

End Sub
Private Sub OptionButton2_Click()
Dim acontrol As Control
For Each acontrol In Me.Controls
With acontrol
If .Tag = "Individual" Then
.Visible = True
ElseIf .Tag = "Company" Then
.Visible = False
End If
End With
Next acontrol

End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Kiwi User" <KiwiUser.DeleteThis@discussions.microsoft.com> wrote in message
news:F34D207C-BFB1-4C81-A952-4E8FF091D08F@microsoft.com...
> Hi,
>
> I have a form that I have completed with radio buttons, which, when
> selected
> shows a different set of fields for the user.
>
> I know how to make a frame visible, but the problem I see with this is the
> "space" two separate frames make when only one is chosen.
>
> I decided upon a multipage layout with the style as fmTabStyleNone so it
> looks seemless.
>
> The problem I am having is getting the correct (actually, any!) multipage
> layout to appear on selection of the radio button. So far I have:
>
> _______
> hides the frame which surrounds the multipage until radio is selected
> _______
>
> Public Sub UserForm_Initialize()
>
> TabsFrame.Visible = False
>
>
> End Sub
>
>
> _______
> I copied this from the help file but can't get it to work Sad Error
> message is Invalid class string
> _______
> Private Sub TOption1_Click()
> Tabs.Visible = True
>
> Dim TabIndividual As Control
>
> If TOption1 = True Then
> Set TabIndividual = TabsFrame.Pages(0).Controls.Add("frmMain" _
> & ".TextBox.1", "TabIndividual", Visible)
>
>
> End If
>
> End Sub
>
> Private Sub TOption2_Click()
> Tabs.Visible = True
>
> Dim TabCompany As Control
>
> If TOption2 = True Then
> Set TabCompany = TabsFrame.Pages(0).Controls.Add("frmMain" _
> & ".TextBox.1", "TabCompany", Visible)
>
>
> End If
>
> End Sub
>
>
>
>
> Thanks in advance!!
Back to top
Kiwi User
External


Since: Feb 09, 2006
Posts: 7



PostPosted: Wed Jul 08, 2009 4:56 pm    Post subject: Re: Multipage [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Doug.

I've got all that to work - but one question. If I click on the radio to
show up say "Individual" the correct multipage tab (control) appears. But if
I then click on Company it won't change the control. Am I able to do this
(no doubt I will have users that will select the wrong one!)

Cheers

"Doug Robbins - Word MVP" wrote:

> I would just put all of the controls on the one form and assign a tag name
> to each control in each group (e.g. use Company for the company controls and
> Individual for the individual controls) and then use the following code for
> the Option buttons:
>
> Private Sub OptionButton1_Click()
> Dim acontrol As Control
> For Each acontrol In Me.Controls
> With acontrol
> If .Tag = "Company" Then
> .Visible = True
> ElseIf .Tag = "Individual" Then
> .Visible = False
> End If
> End With
> Next acontrol
>
> End Sub
> Private Sub OptionButton2_Click()
> Dim acontrol As Control
> For Each acontrol In Me.Controls
> With acontrol
> If .Tag = "Individual" Then
> .Visible = True
> ElseIf .Tag = "Company" Then
> .Visible = False
> End If
> End With
> Next acontrol
>
> End Sub
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
> "Kiwi User" <KiwiUser.TakeThisOut@discussions.microsoft.com> wrote in message
> news:F34D207C-BFB1-4C81-A952-4E8FF091D08F@microsoft.com...
> > Hi,
> >
> > I have a form that I have completed with radio buttons, which, when
> > selected
> > shows a different set of fields for the user.
> >
> > I know how to make a frame visible, but the problem I see with this is the
> > "space" two separate frames make when only one is chosen.
> >
> > I decided upon a multipage layout with the style as fmTabStyleNone so it
> > looks seemless.
> >
> > The problem I am having is getting the correct (actually, any!) multipage
> > layout to appear on selection of the radio button. So far I have:
> >
> > _______
> > hides the frame which surrounds the multipage until radio is selected
> > _______
> >
> > Public Sub UserForm_Initialize()
> >
> > TabsFrame.Visible = False
> >
> >
> > End Sub
> >
> >
> > _______
> > I copied this from the help file but can't get it to work Sad Error
> > message is Invalid class string
> > _______
> > Private Sub TOption1_Click()
> > Tabs.Visible = True
> >
> > Dim TabIndividual As Control
> >
> > If TOption1 = True Then
> > Set TabIndividual = TabsFrame.Pages(0).Controls.Add("frmMain" _
> > & ".TextBox.1", "TabIndividual", Visible)
> >
> >
> > End If
> >
> > End Sub
> >
> > Private Sub TOption2_Click()
> > Tabs.Visible = True
> >
> > Dim TabCompany As Control
> >
> > If TOption2 = True Then
> > Set TabCompany = TabsFrame.Pages(0).Controls.Add("frmMain" _
> > & ".TextBox.1", "TabCompany", Visible)
> >
> >
> > End If
> >
> > End Sub
> >
> >
> >
> >
> > Thanks in advance!!
>
>
Back to top
Doug Robbins - Word MVP
External


Since: Jul 14, 2006
Posts: 2665



PostPosted: Thu Jul 09, 2009 12:10 am    Post subject: Re: Multipage [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

My suggestion involved having all of the controls on the one form with the
Individual tagged controls overlaid over the Company tagged controls with
only ever one set of tagged controls being visible at the one time, which
would require some code in the Initialize event of the userform.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Kiwi User" <KiwiUser RemoveThis @discussions.microsoft.com> wrote in message
news:42B9A511-B85D-49CF-8809-20395DFB7222@microsoft.com...
> Thanks Doug.
>
> I've got all that to work - but one question. If I click on the radio to
> show up say "Individual" the correct multipage tab (control) appears. But
> if
> I then click on Company it won't change the control. Am I able to do this
> (no doubt I will have users that will select the wrong one!)
>
> Cheers
>
> "Doug Robbins - Word MVP" wrote:
>
>> I would just put all of the controls on the one form and assign a tag
>> name
>> to each control in each group (e.g. use Company for the company controls
>> and
>> Individual for the individual controls) and then use the following code
>> for
>> the Option buttons:
>>
>> Private Sub OptionButton1_Click()
>> Dim acontrol As Control
>> For Each acontrol In Me.Controls
>> With acontrol
>> If .Tag = "Company" Then
>> .Visible = True
>> ElseIf .Tag = "Individual" Then
>> .Visible = False
>> End If
>> End With
>> Next acontrol
>>
>> End Sub
>> Private Sub OptionButton2_Click()
>> Dim acontrol As Control
>> For Each acontrol In Me.Controls
>> With acontrol
>> If .Tag = "Individual" Then
>> .Visible = True
>> ElseIf .Tag = "Company" Then
>> .Visible = False
>> End If
>> End With
>> Next acontrol
>>
>> End Sub
>>
>>
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
>> "Kiwi User" <KiwiUser RemoveThis @discussions.microsoft.com> wrote in message
>> news:F34D207C-BFB1-4C81-A952-4E8FF091D08F@microsoft.com...
>> > Hi,
>> >
>> > I have a form that I have completed with radio buttons, which, when
>> > selected
>> > shows a different set of fields for the user.
>> >
>> > I know how to make a frame visible, but the problem I see with this is
>> > the
>> > "space" two separate frames make when only one is chosen.
>> >
>> > I decided upon a multipage layout with the style as fmTabStyleNone so
>> > it
>> > looks seemless.
>> >
>> > The problem I am having is getting the correct (actually, any!)
>> > multipage
>> > layout to appear on selection of the radio button. So far I have:
>> >
>> > _______
>> > hides the frame which surrounds the multipage until radio is selected
>> > _______
>> >
>> > Public Sub UserForm_Initialize()
>> >
>> > TabsFrame.Visible = False
>> >
>> >
>> > End Sub
>> >
>> >
>> > _______
>> > I copied this from the help file but can't get it to work Sad Error
>> > message is Invalid class string
>> > _______
>> > Private Sub TOption1_Click()
>> > Tabs.Visible = True
>> >
>> > Dim TabIndividual As Control
>> >
>> > If TOption1 = True Then
>> > Set TabIndividual = TabsFrame.Pages(0).Controls.Add("frmMain" _
>> > & ".TextBox.1", "TabIndividual", Visible)
>> >
>> >
>> > End If
>> >
>> > End Sub
>> >
>> > Private Sub TOption2_Click()
>> > Tabs.Visible = True
>> >
>> > Dim TabCompany As Control
>> >
>> > If TOption2 = True Then
>> > Set TabCompany = TabsFrame.Pages(0).Controls.Add("frmMain" _
>> > & ".TextBox.1", "TabCompany", Visible)
>> >
>> >
>> > End If
>> >
>> > End Sub
>> >
>> >
>> >
>> >
>> > Thanks in advance!!
>>
>>
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> User Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum