Radio Button help 
Author Message
 Radio Button help

I'm developing a template which will include about seven bookmarks,
each new document based on the template being populated at various
points with text derived from an AutoNew userform. Six of these
bookmarks will have text from text boxes completed by the user, but
the seventh piece of infomation is a straightforward Yes/No
alternative, so I'm using radio buttons.

My code for exporting data from the text boxes is working fine in
experimental form, reading like this:

Private Sub CommandButton1_Click()
With ActiveDocument.Bookmarks
        .Item("A").Range.InsertBefore TextBox1
        .Item("B").Range.InsertBefore TextBox2
(etc)

End With
        Unload Me
End Sub

How do I edit my code so that bookmark "G" takes the text "Apples" if
button "Yes" is selected, but "Oranges" if "No" is selected?

I'm sure this is easy, but I've never worked with option buttons
before.

Thanks for any help.

Regards

Jonathan Morton



Sat, 06 Nov 2004 07:18:50 GMT  
 Radio Button help
Here's one way, assuming your Yes button is called optYes.

Private Sub CommandButton1_Click()
With ActiveDocument.Bookmarks
        .Item("A").Range.InsertBefore TextBox1
        .Item("B").Range.InsertBefore TextBox2
        If optYes.Value = True then
           .Item("G").Range.InsertBefore "Yes"
        Else
           .Item("G").Range.InsertBefore "No"
        End If
(etc)

End With
        Unload Me
End Sub

Bill Coan


Quote:
> I'm developing a template which will include about seven bookmarks,
> each new document based on the template being populated at various
> points with text derived from an AutoNew userform. Six of these
> bookmarks will have text from text boxes completed by the user, but
> the seventh piece of infomation is a straightforward Yes/No
> alternative, so I'm using radio buttons.

> My code for exporting data from the text boxes is working fine in
> experimental form, reading like this:

> Private Sub CommandButton1_Click()
> With ActiveDocument.Bookmarks
>         .Item("A").Range.InsertBefore TextBox1
>         .Item("B").Range.InsertBefore TextBox2
> (etc)

> End With
>         Unload Me
> End Sub

> How do I edit my code so that bookmark "G" takes the text "Apples" if
> button "Yes" is selected, but "Oranges" if "No" is selected?

> I'm sure this is easy, but I've never worked with option buttons
> before.

> Thanks for any help.

> Regards

> Jonathan Morton



Sat, 06 Nov 2004 09:41:55 GMT  
 Radio Button help
Or you can refine it a little more if the radio button caption is the
text you want to insert you can do so directly.

         If optApples.Value = True then  .Item("G").Range.InsertBefore
optApples.caption

Cheers
TonyS.

Quote:

> Here's one way, assuming your Yes button is called optYes.

> Private Sub CommandButton1_Click()
> With ActiveDocument.Bookmarks
>         .Item("A").Range.InsertBefore TextBox1
>         .Item("B").Range.InsertBefore TextBox2
>         If optYes.Value = True then
>            .Item("G").Range.InsertBefore "Yes"
>         Else
>            .Item("G").Range.InsertBefore "No"
>         End If
> (etc)

> End With
>         Unload Me
> End Sub

> Bill Coan



> > I'm developing a template which will include about seven bookmarks,
> > each new document based on the template being populated at various
> > points with text derived from an AutoNew userform. Six of these
> > bookmarks will have text from text boxes completed by the user, but
> > the seventh piece of infomation is a straightforward Yes/No
> > alternative, so I'm using radio buttons.

> > My code for exporting data from the text boxes is working fine in
> > experimental form, reading like this:

> > Private Sub CommandButton1_Click()
> > With ActiveDocument.Bookmarks
> >         .Item("A").Range.InsertBefore TextBox1
> >         .Item("B").Range.InsertBefore TextBox2
> > (etc)

> > End With
> >         Unload Me
> > End Sub

> > How do I edit my code so that bookmark "G" takes the text "Apples" if
> > button "Yes" is selected, but "Oranges" if "No" is selected?

> > I'm sure this is easy, but I've never worked with option buttons
> > before.

> > Thanks for any help.

> > Regards

> > Jonathan Morton



Sat, 06 Nov 2004 21:12:57 GMT  
 Radio Button help

Quote:

> Or you can refine it a little more if the radio button caption is the
> text you want to insert you can do so directly.

>          If optApples.Value = True then  .Item("G").Range.InsertBefore
> optApples.caption

> Cheers
> TonyS.

Thanks, Tony. That works perfectly.

Jonathan



Sun, 07 Nov 2004 05:42:07 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Radio Buttons - HELP

2. Radio Buttons - HELP

3. radio button help...

4. Disable button and change button value at radio

5. Please help with the basics of Radio Buttons

6. Help with Radio Buttons in Word forms

7. Help on Bound radio buttons

8. Help needed for Frames, text boxes, radio buttons and scrolling (F^2)

9. Help with radio buttons

10. HELP, trouble with radio buttons

11. Help on dropdown and radio button

12. Radio Button and SQL Statement Help

 

 
Powered by phpBB® Forum Software