Re: option buttons

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Sue Mosher [MVP-Outlook] (suemvp_at_outlookcode.com)
Date: 03/16/04


Date: Tue, 16 Mar 2004 10:37:18 -0500

In that case, I would use checkboxes, not option buttons, and code something
like this: You'll have to make the page and control names match those in
your form, of course:

Sub chkAddress1_Click()
    Call SetTo
End Sub

Sub chkAddress2_Click()
    Call SetTo
End Sub

Sub SetTo()
    Set objPage = Item.GetInspector.ModifiedFormPages("Message")
    Set chkAddress1 = objPage.Controls("chkAddress1")
    Set chkAddress2 = objPage.Controls("chkAddress2")
    strTo = ""
    If chkAddress1.Value = True Then
        strTo = "address1@somewhere.com"
    End If
    If chkAddress2.Value = True Then
         strTo = strTo & ";" & "address2@somewhere.com"
    End If
    Item.To = strTo
End Sub

My book is available through Amazon.com and other online retailers, or you
can ask your local bricks-and-mortar store to order it for you if they don't
have it on the shelf.

-- 
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx
<anonymous@discussions.microsoft.com> wrote in message
news:e05501c40b62$0a5a7f20$a401280a@phx.gbl...
I want to have the addresses added to the to field. There
will only be two names to select from. If the user selects
both then both of them will go into the To field. I just
need the information for this one area. It will not be
used in the message or in the body.
Thanks
Sue were can I get your book?
>-----Original Message-----
>You'll need to tell us more:
>
>-- Do you want the address to be appended to the To field
or to replace any
>addresses already in the To field?
>
>-- Do you want to store the user's choice from those
option buttons in the
>item? Or do you need the information just temporarily to
set the address?
>
>In the meantime, see
http://www.outlookcode.com/d/formcontrols.htm for
>option button basics.
>-- 
>Sue Mosher, Outlook MVP
>Author of
>     Microsoft Outlook Programming - Jumpstart for
>     Administrators, Power Users, and Developers
>     http://www.outlookcode.com/jumpstart.aspx
>
>
>"gm" <anonymous@discussions.microsoft.com> wrote in
message
>news:de6a01c40b5e$509e75d0$a301280a@phx.gbl...
>I have two option buttons in a form. One button is
>OPB_L the other is
>OPB_M
>
>If the user selects one or both of these buttons I want an
>e-maill address to fill in the to field. How do you do
>this?
>
>
>Thanks
>in advance
>
>
>.
>

Quantcast