Results 1 to 3 of 3

Macro to send via email specific sheet tabs to specific people?

This is a discussion on Macro to send via email specific sheet tabs to specific people? within the Excel Questions forums, part of the Question Forums category; Hi folks need a bit of expert help please! i have a big excel workbook with maybe 30 sheet tabs, ...

  1. #1
    New Member
    Join Date
    Oct 2011
    Posts
    19

    Default Macro to send via email specific sheet tabs to specific people?

    Hi folks

    need a bit of expert help please!

    i have a big excel workbook with maybe 30 sheet tabs, maybe 5 of them are my various calculations, lookups etc and after a certain tab they are all the outputs and each of these sheet tabs are titled with some letters to signify the manager responsible.

    The help i am looking for is to see if it is possible via macro code to lookup a sheet tab after a certain point eg after one called 'summary' then email just the sheet tab (not the whole workbook) to a specified email.

    I have other macros run which hard code all formula so no links remain.

    I am not sure i am being too clear, so i will try to give an example.

    I have a sheet tab called 'Look Ups' which in column A has a 3 digit team code and then in column B is the actual name of the team leader. In column C i was hoping to add in an email address.

    i would like a macro to cycle through the lookup list in column A, use the team code it finds there to then select the same named sheet tab and then email just that sheet tab to the actual email address of the team leader it matches to in column c of my lookup up list, then keep doing this until it reaches the end of the team codes.

    Hope this makes sense in the help i am asking for!!

    thanks

    Paul

  2. #2
    MrExcel MVP Jerry Sullivan's Avatar
    Join Date
    Mar 2010
    Location
    San Diego, California
    Posts
    6,786

    Default Re: Macro to send via email specific sheet tabs to specific people?

    Hi Paul,

    Ron de bruin has examples for many different scenarios of using Excel to send workbooks and worksheets.

    http://www.rondebruin.nl/sendmail.htm

    If you need any help adapting one of these examples to your situation, just post the code you are trying and any problems you are having.
    Using Excel 2010, 2013

  3. #3
    New Member
    Join Date
    Aug 2014
    Posts
    1

    Default Re: Macro to send via email specific sheet tabs to specific people?

    Quote Originally Posted by Jerry Sullivan View Post
    Hi Paul,

    Ron de bruin has examples for many different scenarios of using Excel to send workbooks and worksheets.

    Mail from Excel example pages

    If you need any help adapting one of these examples to your situation, just post the code you are trying and any problems you are having.
    Hello, I wunderkind any one can help, I'm using the code found on the above website but looking for it to be tweaked slightly, I need the file name to be the same as say A1 and the subject to be the same as A2 the code I have at the moment is:

    So far it opens outlook withe email address subject and body text by it dosent attach the file
    Any help would be greatly appreciated and thank you
    Sub Upload()

    Dim wb1 As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object

    With Application
    .ScreenUpdating = False
    .EnableEvents = False
    End With

    Set wb1 = ActiveWorkbook

    'Make a copy of the file/open it/Mail it/Delete it
    'If you want to change the file name then change only TempFileName
    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Set Up"
    FileExtStr = "." & LCase(Right(wb1.Name, Len(wb1.Name) - InStrRev(wb1.Name, ".", , 1)))

    wb1.SaveCopyAs TempFilePath & TempFileName & FileExtStr

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
    .to = "Test@test.Co.uk
    .cc = ""
    .BCC = ""
    .Subject = "This is Only A Test"
    .Body = "Hi There"
    .Attachment.Add TempFilePath & TempFileName & FileExtStr
    .Display
    End With
    On Error GoTo 0

    'Delete the File
    Kill TempFilePath & TempFileName & FileExtStr

    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
    .ScreenUpdating = True
    .EnableEvents = True
    End With
    End Sub

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com