Consulting

Results 1 to 7 of 7

Thread: Send Excel sheet as email attachment using worksheet data using Windows 2010.

  1. #1
    VBAX Newbie
    Joined
    May 2021
    Posts
    4
    Location

    Send Excel sheet as email attachment using worksheet data using Windows 2010.

    Hi Can anyone help, I am trying to Send a completed Excel sheet as email attachment using worksheet data using Windows 2010. Thank you in advance
    Last edited by ihenry; 05-31-2021 at 05:22 AM.

  2. #2
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    528
    Location
    Option Explicit
    
    Sub Email_Worksheet_As_Workbook()
        ActiveSheet.Copy
        With ActiveWorkbook
            '.Windows(1).Visible = False
            Application.DisplayAlerts = False
            .SaveAs Environ("TMP") & "\tmp.xlsx", FileFormat:=xlWorkbookDefault, ConflictResolution:=xlLocalSessionChanges
            Application.DisplayAlerts = True
            .Close (True)
        End With
        
        With CreateObject("Outlook.Application").CreateItem(0)
            .To = "me@yahoo.com"
            .Subject = "Worksheet: " & ActiveSheet.Name
            .Body = ""
            .Attachments.Add Environ("TMP") & "\tmp.xlsx"
            .Display
            '.send
        End With
    End Sub

  3. #3
    VBAX Newbie
    Joined
    May 2021
    Posts
    4
    Location
    Hi Logit

    Thank you so much, the code worked fine, the only thing now is how do I create a buttom that sits on the main page of the spreadsheet so that is can be run without opening up the VBAProject.

    Once again thank you.

  4. #4

  5. #5
    VBAX Newbie
    Joined
    May 2021
    Posts
    4
    Location
    Hi Logit

    Thank you so much, the code worked fine, the only thing now is how do I create a buttom that sits on the main page of the spreadsheet so that is can be run without opening up the VBAProject.

    Once again thank you.

  6. #6
    VBAX Newbie
    Joined
    May 2021
    Posts
    4
    Location
    Hi Logit

    Thats, me completed what I set out to do, thank you so much for your help with this one.

    Everything is working perfectly.

    Thank you

    Best regards

  7. #7
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    528
    Location
    Glad to assist.

Posting Permissions

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