CODE FOR CHECK BOXES, AND EXCEL AS ATTACHMENT !

  • Thread starter Thread starter jay dean
  • Start date Start date
J

jay dean

2 questions:
(1) I have created a check box in a worksheet using the visual basic
toolbar (not forms). I need a code to assign to the check box such that
when clicked on, the check box displays "X" instead of a check mark, and
when clicked on again it displays nothing. In other words when clicked
on, the check box should toggle between "X" and not showing anything.

(2) I need a code that will attach the current workbook (say
WorkbookA.xls) as an e-mail attachment. I use microsoft outlook. The
"TO:" field of the e-mail should contain two addresses like
"(e-mail address removed)" and "(e-mail address removed)" and the subject line of the e-mail
should contain a subject like "Hello World!". The body of the e-mail
should contain a message like "Thank you for your participation". All of
the above must be done automatically.
Any help would be greatly appreciated. Thanks in advance!
Jay Dean
 
Jay,

Frank Kabel has given you an excellent site for sending emails.

Now for the check box...
Instead of using a check box - use a change event. You can add formatting
and other stuff...

This will work when $A$1 is selected.
'''''''''''''''''''
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Len(Target) = 0 Then
Target.Formula = "X"
Else: Target.ClearContents
End If
End If
End Sub
'''''''''''''''''
And this one will work when $A$1 is double clicked
''''''''''''''''
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$A$1" Then
If Len(Target) = 0 Then
Target.Formula = "X"
Else: Target.ClearContents
End If
End If
Target.Offset(1, 0).Activate
End Sub
'''''''''''''''''''''''
hth
 
Thanks Steve and Frank for all your help.
I have one more question on the check box issue. It is for a survey so I
will need to create more check boxes. If I create check boxes using the
VB Toolbar (not forms) in my sheet, do they need extra coding to be
assigned for the check sign to toggle?
Thanks.

Jay Dean
 

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

Back
Top