Userform ?? using checkboxes

G

Guest

I have a userform that will have a list of e-mail address. Using checkboxes if the user clicks in it I want capture that e-mail and use it in another part of my script. The script that I am useing is changing the caption of the checkbox and I am using the message window for testing purposes to see what is happening. So if the box is checked it would capture that e-mail adress and use later in the script if it is unchecked that e-mail address does not get used. I am posting the script that I currently have. I think that I am close but I am missing something. Thank

Sub bOk_Click(
With Me.CheckBox
If Me.CheckBox1.Value = True The
Me.Controls("Checkbox1").Caption = "It's checked
MsgBox Me.Controls("Checkbox1").Captio
Els
Me.CheckBox1.Value = Fals
Me.Controls("Checkbox1").Caption = "Unchecked
MsgBox Me.Controls("Checkbox1").Captio
End I
End Wit
End Su
 
B

Bob Phillips

Steve,

Although your code is a little simpler as

With Me.CheckBox1
If Me.CheckBox1.Value = True Then
Me.CheckBox1.Caption = "It's checked"
MsgBox Me.CheckBox1.Caption
Else
Me.CheckBox1.Value = False
Me.CheckBox1.Caption = "Unchecked"
MsgBox Me.CheckBox1.Caption
End If
End With

your code seems to work. What does it not do?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Steve said:
I have a userform that will have a list of e-mail address. Using
checkboxes if the user clicks in it I want capture that e-mail and use it in
another part of my script. The script that I am useing is changing the
caption of the checkbox and I am using the message window for testing
purposes to see what is happening. So if the box is checked it would capture
that e-mail adress and use later in the script if it is unchecked that
e-mail address does not get used. I am posting the script that I currently
have. I think that I am close but I am missing something. Thanks
 
G

Guest

The code seems to work, but in the userform itself when I drag checkbox1 onto the form and run this it checges the name of checkbox1 to "It's checked" or "Unchecked" depending on what is going on. I don't want the checkbos label to change.
 
B

Bob Phillips

Then don't change it

With Me.CheckBox1
If Me.CheckBox1.Value = True Then
MsgBox Me.CheckBox1.Caption
Else
Me.CheckBox1.Value = False
MsgBox Me.CheckBox1.Caption
End If
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Steve said:
The code seems to work, but in the userform itself when I drag checkbox1
onto the form and run this it checges the name of checkbox1 to "It's
checked" or "Unchecked" depending on what is going on. I don't want the
checkbos label to change.
 

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