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: 1
Default Checkbox to remove recipient from email

I am creating a workbook where each worksheet represents Vacation Leav
Hours accrued for an employee. The Vacation information is update
weekly and then I press a custom toolbar button that activates a macr
that emails each induvidual statement to that particular emloyee only
The employee's email address is stored in b2. The employee's superviso
also gets a copy so they can monitor how much vacation that thei
employee(s) might be taking in the near future. There are approx 5
employees/worksheets. I created the macro by altering VBA code take
from Ron DeBruin's website and it works very well.

Now I need to add checkboxes next to the two email addresses with
note that if checked, the email address next to this checkbox is not t
recieve a copy of this worksheet during the bulk mailing. This will cu
down on the amount of mail in an inbox for an employee or superviso
who does not care about the statement.

When I added CheckBox1 and CheackBox2 and the following code, I a
running into problems with people that are not supposed to recieve an
email still getting one, and everone recieves a copy of worksheet
instead of their own worksheet. Any suggestions would be appreciated.

-Joe

Here's what I have so far. I will also attach a sample calle
3WACAP_Leave.xls


Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False
'loop through each wookbook
For Each sh In ThisWorkbook.Worksheets
sh.Copy
Set wb = ActiveWorkbook
With wb
Dim strdate As String
Dim firstName As String
strdate = Format(Now, "mm-dd-yy")
'Get the employee's first name from b2
firstName = sh.Range("b2").Value
.SaveAs firstName & "'s Leave Hours as of " & " "
strdate & ".xls"
'check to see if this person wants a copy of the leav
statement
If wb.CheckBox1.Value = False Then
'send statement of leave to employee
.SendMail ActiveSheet.Range("e2").Value, _
firstName & "'s Leave Hours as of " & " "
strdate
ElseIf wb.CheckBox1.Value = True Then
End If
'check to see if this person wants a copy of the leav
statement
If wb.CheckBox2.Value = False Then
'send copy to employee's supervisor
.SendMail ActiveSheet.Range("e5").Value, _
"Your employee " & firstName & "'s Leave Hours a
of " & " " & strdate
ElseIf wb.CheckBox2.Value = True Then
End If

.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Next sh
'end of loop
Application.ScreenUpdating = True
End Su

Attachment filename: 3wacap_leave.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=45047
--
Message posted from http://www.ExcelForum.com

 
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
send excel sheet to email recipient as hyperlink Cyndi Excel Discussion (Misc queries) 2 May 20th 09 02:15 PM
Send To Email recipient one sheet from workbook Doug Excel Discussion (Misc queries) 1 October 3rd 08 05:38 PM
How can I send an excel workbook by email for recipient to update? Melanie Excel Discussion (Misc queries) 3 February 6th 06 02:37 AM
.xls email attachments are arriving at the recipient as .dat file. UK-Graham Excel Discussion (Misc queries) 4 February 11th 05 05:32 PM
File...Send To...Email Recipient Bill Oertell[_2_] Excel Programming 2 January 1st 04 03:02 AM


All times are GMT +1. The time now is 11:48 PM.

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

About Us

"It's about Microsoft Excel"