Consulting

Results 1 to 4 of 4

Thread: Solved: How to e-mail 2 worksheets?

  1. #1

    Solved: How to e-mail 2 worksheets?

    Hi there, i'm trying to send via a single e-mail, two worksheets (1 and 3) to a specific e-mail.

    Currently i'm using a code that sends only one sheet per e-mail.

    Can you help me?

    What I have right now is:

    Sub emailalge()


    ThisWorkbook.Sheets(3).Copy


    With ActiveWorkbook
    .SendMail Recipients:="email@email.com_
    Subject:="e-mail " & Format(Date, "dd/mmm/yy")
    .Close SaveChanges:=False
    End With

    End Sub


    thanks!

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings,

    Not well tested, try:

    In a Standard Module:

    Sub exa4()
    Dim wbTemp As Workbook
        
        Set wbTemp = Workbooks.Add(xlWBATWorksheet)
        
        With wbTemp
            '// NOTE: we are using the worksheets' tab names rather than positions      //
            ThisWorkbook.Worksheets(Array("MySheet", "MyOtherSheet")).Copy _
                After:=.Worksheets(.Worksheets.Count)
            
            Application.DisplayAlerts = False
            .Worksheets(1).Delete
            Application.DisplayAlerts = True
            DoEvents
            .SendMail Recipients:="email@email.com", _
                      Subject:="e-mail " & Format(Date, "dd/mmm/yy")
            .Close SaveChanges:=False
        End With
    End Sub
    Hope that helps,

    Mark

  3. #3

    Solved!

    It worked perfectly!!! thank you very much!!!

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Glad to help

    If solved, there is an option under Thread Tools to mark as such. This helps others in not continuing to check the thread if looking to help.

    Have a great day

    Mark

Posting Permissions

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