+ Reply to Thread
Results 1 to 4 of 4

Tweak to existing VBA code to send emails on Mac

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-12-2014
    MS-Off Ver
    Excel 2013
    Posts
    131

    Tweak to existing VBA code to send emails on Mac

    Y'all, I'm about to pull what little hair I have left out of my head.

    I know sending emails from Mac using VBA is a pain, and I know Ron de Bruin has a workaround that's wonderful. The issue is that his workaround requires the installation of a script onto the end user's machine, and I can't use it as a result (my IT department won't allow me to create an automated script to place the file in the correct location and I don't trust the end users to execute properly).

    So I might be up the proverbial creek here, but this is all I want to know:

    Is there a way to modify this code
    Formula: copy to clipboard
    Sub Mail()
    Dim OutlookApp As Object
    Dim Mess As Object
    Set OutlookApp = CreateObject("Outlook.Application")
    Set Mess = OutlookApp.CreateItem(olMailItem)
    With Mess


    to NOT use Outlook as its default mailing application? Or to use a Hyperlink in some way instead? The HYPERLINK function works!... until there's more than like, 4 email addresses being concatenated, then it returns the #VALUE! error.

    I'm at my wit's end. I just want this email functionality to work on both Mac and PC, nothing more. PC is a charm. Mac is... just ugh.

    If anyone has ANY functional suggestions that don't involve my end users on Mac having to do anything other than click a button/link, I will name a star after you.
    Please help.

  2. #2
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2010 32-Bit
    Posts
    280

    Re: Tweak to existing VBA code to send emails on Mac

    Just an FYI, the reason CreateObject("Outlook.Application") works is due to Windows' COM model, which all the other OS's don't have(ok except maybe WINE on Linux). I don't know the Nuts'n'Bolts of Mac's OS, but I feel fairly confident in stating that MS did not implement whichever low-level marshaling system Mac has into Mac-Excel (we can barely get them to do it for Windows, and my fear is not at all for UWP).

    however since it sounds like you've had some limited success with hyperlinks have you tried Workbook.FollowHyperlink yet?
    Private Sub MailTest1()
        Dim str As String
        str = "mailto:[email protected]"
        str = str & ",[email protected]"
        str = str & "?="
        str = str & "&[email protected]"
        str = str & ",[email protected]"
        str = str & "&[email protected]"
        str = str & ",[email protected]"
        str = str & "&subject=" & Replace("Here's an awesome email", " ", "%20")
        str = str & "&body=" & Replace("Here's an awesome email", " ", "%20")
        
        ActiveWorkbook.FollowHyperlink Address:=str
    End Sub
    If it'd make you feel better using my answer because of my street cred, then you can go ahead and click Add Reputation below to improve it.

  3. #3
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2010 32-Bit
    Posts
    280

    Re: Tweak to existing VBA code to send emails on Mac

    also just stumbled upon this SO Article which may be of some use to you, but don't ask me how it works I can't test it without a mac.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Tweak to existing VBA code to send emails on Mac

    Have you considered instead of the .scrpt file, that you make a big string function and pass the result to the MacScript function.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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] Existing Code tweak needed
    By Pr0 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2018, 10:36 AM
  2. [SOLVED] Slight Tweak to existing code
    By Nitro2481 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2016, 03:35 PM
  3. Use of CDO code to send emails failing
    By DEB1000 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-29-2015, 03:49 PM
  4. Help with code to send automatic emails
    By hauckj14 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-16-2015, 12:45 PM
  5. Any Excel code to send emails automatically
    By knighty2002uk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2014, 05:55 AM
  6. Tweak an Existing Code
    By mkeys4 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2013, 10:00 AM
  7. existing macro to send emails to multiple recipents needs fix
    By kiranpat in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2013, 12:17 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