Results 1 to 5 of 5
  1. #1


    Member Since
    May 26, 2007
    Posts
    3
    Send Excel workbook as attachment
    I am desprately seeking a way to send an Excel workbook as an attachment to WHATEVER the default mail program is (in this case, OS X Mail).

    I have a cross platform file - If the user is on a Windows system, there are lots of easy ways to send email. However, when the user is on a Mac OS X machine, the default mail options do not work (because they are linked to Outlook). SO... here's what I've tried...

    1.
    ActiveWorkbook.FollowHyperlink _
    "mailto:me@isp.org" & _
    "?subject=I have a dream.." & _
    "&body=That one day soon this will work!"

    Great. Calls up the default mail program. But - doesn't attach the current workbook.


    2. Application.Dialogs(xlDialogSendMail).Show

    3. All the different PC options... they all fail in OS X.

    This is what excel generates what I record a macro to send workbook as attachment. But - when I play it back, it generates a runtime error and claims that xlDialogSendMail isn't valid.

    HELP!!! There has to be SOMEONE out there who knows how to send an excel workbook on a Mac.... I just can't work it out, have even tried looking for an AppleScript solution, but that's a whole new world to me, so I'm very lost.

  2. #2


    Member Since
    May 20, 2004
    Posts
    243
    Specs:
    iMac 21" 8GB, MBP 15" 2.5 Penryn, 4 GB/180 GB
    Howdy. Several problems: DilaogSendmail does not work on Mac, despite the recordability. Also, the reference to files is slightly different on the Mac than on Win. Also, here is one approach using Entourage (Mac step-sister of Outlook).

    Jim McGimpsey Mac MVP has put togehter both VBA and AppleScript to do what you need. Send attachments with Entourage

  3. #3


    Member Since
    May 20, 2004
    Posts
    243
    Specs:
    iMac 21" 8GB, MBP 15" 2.5 Penryn, 4 GB/180 GB
    BTW, Entourage does not support VBA, so AppleScript is the only way to go.

  4. #4


    Member Since
    May 26, 2007
    Posts
    3
    Excellent....

    I tried the VBA solution and it works perfectly with Mail, but as there is not way to auto add the recipient or subject, I would like to try the AppleScript solution.

    I've tried to make a small change to the code so it calls Mail instead of Entourage... but I get this error: "Invalid procedure call or argument."

    This is the code:
    Code:
    Public Sub MailSendMail(theBook As Workbook, _
                recipient As String, subject As String)
            Dim mailStr As String
            
            mailStr = _
                "Tell application ""Mail""" & vbNewLine & _
                "make new outgoing message with properties" & _
                "{recipient:""" & recipient & """,subject:""" & subject & _
                """,attachment:""" & theBook.FullName & """}" & vbNewLine _
                & "move the result to out box folder" & vbNewLine & _
                "send" & vbNewLine & _
                "end tell"
                
            MacScript mailStr
            
        End Sub
        
        
        Sub sendit()
            MailSendMail ThisWorkbook, "jodcmh@bigpond.net.au", "this is the subject"
        End Sub

    I'm guessing that's because there the script for Mail is slightly different than that for Entourage... but I'm not sure where I need to change things. I've tried running the script in script editor and it fails at 'move to out box folder'. If I remove this, it appears to run, but no mail item is actually sent.

    Thanks for any help... AppleScript is brand new to me.

  5. #5


    Member Since
    May 26, 2007
    Posts
    3
    Almost got it!

    Made some changes... now it looks like this:
    Code:
        Public Sub MailSendMail(theBook As Workbook, _
                recipient As String, subject As String)
            Dim mailStr As String
            
            mailStr = _
                "Tell application ""Mail""" & vbNewLine & _
                "make new outgoing message with properties" & _
                "{recipient:""" & recipient & """,subject:""" & subject & _
                """,attachment:""" & theBook.FullName & """,visible:true}" & vbNewLine _
                & "end tell"
            MacScript mailStr
        End Sub
    
    
    Sub sendmessage()
        MailSendMail ThisWorkbook, "name@address", "This is the subject"
    End Sub
    BUT... the recipient isn't showing up in the message. Subject is fine, but no recipient....

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel Workbook Gallery - Can't delete files
    By bpo1 in forum Apple Desktops
    Replies: 10
    Last Post: 03-04-2015, 07:16 AM
  2. Excel's Personal Macro Workbook
    By SunnySkies in forum OS X - Apps and Games
    Replies: 0
    Last Post: 01-21-2014, 04:11 PM
  3. Slow Excel on new workbook
    By roadrunner01 in forum OS X - Apps and Games
    Replies: 0
    Last Post: 12-03-2012, 12:01 PM
  4. deleting excel workbook
    By carmellajade in forum OS X - Apps and Games
    Replies: 0
    Last Post: 05-02-2012, 08:24 AM
  5. Can't open big Excel workbook on MacBook Air
    By SergeiV in forum OS X - Apps and Games
    Replies: 1
    Last Post: 06-01-2010, 04:01 AM

Posting Permissions

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