LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default differentiating between checkboxes

I am trying to accomplish the following using checkboxes on a userform

1. Scan all the check boxes (there are currently 5, 4 with email addresses)
2. Create a string with the email addresses in the checkboxes that are checked

i am doing this by looking for the "@" in the string

The code below is doing that EXCEPT it is also picking up the string from
the non email checkbox
It is operating from a command button

Sub SendEmailBtn_Click()

Dim CBCtrl As MSForms.Control
Dim RBCtrl As MSForms.Control
Dim strReceipients As String
Dim MsgBody As String

'check to see what checkboxes are checked and add that email to the string
in recipients
For Each CBCtrl In RndmemailFrm.Controls
'If TypeOf CBCtrl Is MSForms.CheckBox Then
If TypeName(CBCtrl) = "CheckBox" Then
If CBCtrl.Object.Value = True Then
If InStr(Ctrl.Caption, "@") 0 Then
strReceipients = strReceipients & ";" & CBCtrl.Caption
End If
End If
End If
Next
MsgBox strReceipients

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Differentiating Case Sensitivity in a Vlookup Cadders Excel Discussion (Misc queries) 4 September 3rd 09 04:23 PM
Help differentiating numbers and dates [email protected] Excel Discussion (Misc queries) 3 May 11th 09 02:04 AM
Differentiating Cell Drag Copy Gap Excel Programming 1 September 8th 05 07:55 AM
differentiating between formulas and values shellshock Excel Discussion (Misc queries) 3 July 7th 05 06:02 PM
differentiating between "and"/"or" in a formula Shooter Excel Worksheet Functions 6 November 4th 04 03:04 PM


All times are GMT +1. The time now is 08:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"