View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default populating the recipient address in outlook

Hi Thomas

Try this code. No matter how many checkboxes are there the loop collects all
receipients which are checked to a string variable

Dim Ctrl As MSForms.Control
Dim strReceipients as String
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSForms.CheckBox Then
If Ctrl.Object.Value = True Then
strReceipients = strReceipients & ";" & Ctrl.Caption
End If
End If
Next
MsgBox Mid(strReceipients, 2)

If this post helps click Yes
---------------
Jacob Skaria


"thomas donino" wrote:

Hello,
I have a form with 4 checkboxes (night add more) that have email addresses.
I cant sort out how to determine which ones are checked to write them into
the recipient area. My thought was to set a variable, the say if #1 is
checked write it to the variable and if the second is checked add it to the
variable or if nothing check # 3 etc etc etc. Am I on the right course? Is
there a more efficient way to code this?

Thank you