+ Reply to Thread
Results 1 to 1 of 1

VBA to perform mass email functions with Apple Mail (Macbook default email program)

  1. #1
    Registered User
    Join Date
    10-24-2014
    Location
    Santa Barbara
    MS-Off Ver
    Mac 2011
    Posts
    4

    VBA to perform mass email functions with Apple Mail (Macbook default email program)

    Regarding the original version: http://spreadsheetpage.com/index.php...il_from_excel/

    This is what I have so far:

    Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
    Sub SendEMail()
    Dim Email As String, Subj As String
    Dim Msg As String, URL As String
    Dim r As Integer, x As Double
    For r = 5 To 9 'data in rows 2-4
    ' Get the email address
    Email = Cells(p, 5)

    ' Message subject
    Subj = "Informational Interview Request"

    ' Compose the message
    Msg = ""
    Msg = Msg & "Hello" & Cells(r, 5) & "," & vbCrLf & vbCrLf
    Msg = Msg & "I'm a student with prior experience in industry. I came across your profile on LinkedIn and I was wondering if you would be open to a brief phone call. I would really appreciate speaking about your current role and experience. I have attached my resume for your consideration."

    Msg = Msg & "Regards, & vbCrLf"
    Msg = Msg & "my name"

    ' Replace spaces with %20 (hex)

    Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
    Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")

    ' Replace carriage returns with %0D%0A (hex)
    Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
    ' Create the URL
    URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg

    ' Execute the URL (start the email client)
    ShellExecute Mail&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus

    ' Wait two seconds before sending keystrokes
    Application.Wait (Now + TimeValue("0:00:02"))
    Application.SendKeys "%s"
    Next r
    End Sub


    I'm trying to build a networking workbook that is able to send mass emails to contacts in areas of industry that I want to work in.
    My question is, how do I edit this macro to run using Apple Mail and add an attachment (pdf version of a resume) to every email sent? I also want to schedule this macro to run at a specific time, I'm assuming the code here would suffice? http://www.ozgrid.com/Excel/run-macro-on-time.htm

    In addition to writing new code for Apple Mail and attaching a pdf file, I'm having trouble editing this portion of code to fit within my needs:


    Replace spaces with %20 (hex)
    Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
    Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")

    ' Replace carriage returns with %0D%0A (hex)
    Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
    ' Create the URL
    URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg

    ' Execute the URL (start the email client)
    ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus

    ' Wait two seconds before sending keystrokes
    Application.Wait (Now + TimeValue("0:00:02"))
    Application.SendKeys "%s"

    Next r

    Thanks a ton!
    Last edited by thianphat; 10-24-2014 at 04:14 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to add an email attachement to VBA Mass Email by referencing file name in column
    By XCL88 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-10-2014, 06:20 AM
  2. How do I find the name of my Default Email program for CreateObject()
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-18-2010, 02:32 AM
  3. Sending an email with the default email program
    By benno87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2009, 07:30 AM
  4. When clicking on email address, DON'T open mail program?
    By bythecshore in forum Excel General
    Replies: 5
    Last Post: 03-07-2009, 02:23 PM
  5. Email addresses in Excel need to format for mass email
    By Boomer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-09-2006, 08:50 AM

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