Consulting

Results 1 to 5 of 5

Thread: Auto Email

  1. #1
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location

    Auto Email

    Hi ALL Experts

    Can anyone help me macros to auto send email with attached the XLS file when the excel file click close to target a person ?

    Thanks

    I used 2003

  2. #2
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location
    adapted from ron debruin code
    [vba]
    Sub Mail_workbook_1()
    'Working in 97-2007
    Dim wb As Workbook

    Set wb = ActiveWorkbook

    If Val(Application.Version) >= 12 Then
    If wb.FileFormat = 51 And wb.HasVBProject = True Then
    MsgBox "There is VBA code in this xlsx file, there will be no VBA code in the file you send." & vbNewLine & _
    "Save the file first as xlsm and then try the macro again.", vbInformation
    Exit Sub
    End If
    End If

    On Error ResumeNext
    wb.SendMail "ron@debruin.nl", _
    "This is the Subject line"
    On Error GoTo 0
    End Sub[/vba]
    Last edited by Aussiebear; 07-08-2010 at 02:18 AM. Reason: Edited post to suit page

  3. #3
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location
    thanks the help, but can u send again the code as it was ....and i can't Reorganize...

  4. #4
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location
    upps...

    [VBA]workbook_1()
    'Working in 97-2007
    Dim wb As Workbook
    Set wb = ActiveWorkbook
    If Val(Application.Version) >= 12 Then
    If wb.FileFormat = 51 And wb.HasVBProject = True Then
    MsgBox "There is VBA code in this xlsx file, there will be no VBA code in "& _
    "the you send." & vbNewLine & _
    "Save the file first as xlsm and then try the macro again.", vbInformation
    Exit Sub
    End If
    End If
    On Error Resume Next
    wb.SendMail "ron@debruin.nl", _
    "This is the Subject line"

    On Error GoTo 0
    End Sub[/VBA]

  5. #5
    VBAX Newbie
    Joined
    Apr 2013
    Posts
    1
    Location
    Book1.xlsm[vba]workbook_1()
    'Working in 97-2007
    Dim wb As Workbook
    Set wb = ActiveWorkbook
    If Val(Application.Version) >= 12 Then
    If wb.FileFormat = 51 And wb.HasVBProject = True Then
    MsgBox "There is VBA code in this xlsx file, there will be no VBA code in "& _
    "the you send." & vbNewLine & _
    "Save the file first as xlsm and then try the macro again.", vbInformation
    Exit Sub
    End If
    End If
    On Error Resume Next
    wb.SendMail "ron@debruin.nl", _
    "This is the Subject line"

    On Error GoTo 0
    End Sub[/vba][/quote]

    Is it possible as below?

    Sheet1 is the contact list as below
    a 11111@qq.com
    b 11112@qq.com
    c 11113@qq.com
    d 11114@qq.com

    then there have 4's sheet, the sheet name as below
    a
    b
    c
    d

    Can it auto send
    sheet "a" to 11111@qq.com as PDF format
    sheet "b" to 11112@qq.com as PDF format
    sheet "c" to 11113@qq.com as PDF format
    sheet "d" to 11114@qq.com as PDF format

Posting Permissions

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