Option button

J

Julia

Hi;

I'd like to have three choices on my user form, one for
FedX, Reg Mail and UPS. If a user clicks the FedX button,
I want it to type "VIA FEDERAL EXPRESS" at the bookmark in
the document. I know how to work with for text boxes, but
not sure about the code for clicking an option button.
Can you help? Thanks in advance
 
D

Doug Robbins - Word MVP

Hi Julia,

Assuming that your controls are inside a frame Frame1, use

Dim i As Integer, j As Integer, acontrol As Control
For i = 1 To 3
Set acontrol = Frame1.Controls(i - 1)
If acontrol.Value = True Then
j = i
End If
Next i
Select Case j
Case 1
ActiveDocument.Bookmarks("route").Range.InsertBefore "VIA FEDERAL
EXPRESS"
Case 2
ActiveDocument.Bookmarks("route").Range.InsertBefore "VIA REGULAR
MAIL"
Case Else
ActiveDocument.Bookmarks("route").Range.InsertBefore "VIA UPS"
End Select

I would run this code from a command button click event.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top