+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : Mail Every Worksheet

Hybrid View

  1. #1
    Registered User
    Join Date
    03-29-2005
    Posts
    48

    Cool Mail Every Worksheet

    Hi,

    I am using Excel 07 and I have about 40 departments and each department is on a different spreadsheet. On the applicable worksheet the emal address of the department head is in cell a1 and another managers email address is in b1.

    I want to be able to send these with a macro to the various department heads using Microsoft Outlook 07. I had this set up in 03 but the same Marco does not work that great in 07.

    I am thinking (excel 03 couldn't but maybe 07 can) also that I want to record a set "blah blah blah" in the body of the email as well and record a set subject line and instead of sending it to the outbox send it to the drafts folder so I have the option of revising it if I want. The following is the Marco recorded in 03

    "
    Sub Outlook_Mail_Every_Worksheet()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strdate As String
    Dim wb As Workbook
    Dim ws As Worksheet
    Application.ScreenUpdating = False
    Set OutApp = CreateObject("Outlook.Application")
    For Each ws In ThisWorkbook.Worksheets
    If ws.Range("a1").Value Like "?*@?*.?*" Then
    strdate = Format(Now, "dd-mm-yy h-mm-ss")
    ws.Copy
    Set wb = ActiveWorkbook
    With wb
    .SaveAs "Sheet " & ws.Name & " of " _
    & ThisWorkbook.Name & " " & strdate
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
    .To = ws.Range("a1").Value
    .CC = ws.Range("b1").Value
    .Subject = "April 2010 Budget Statement"

    .Attachments.Add wb.FullName
    .Send
    End With
    .ChangeFileAccess xlReadOnly
    Kill .FullName
    .Close False
    End With
    Set OutMail = Nothing
    End If
    Next ws
    Set OutApp = Nothing
    Application.ScreenUpdating = True
    End Sub
    "

    Any suggestions of an updated Macro?

    Thanks,
    Last edited by billy2willy; 05-14-2010 at 06:11 PM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Mail Every Worksheet

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1