Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Apps and Programs
Send Excel workbook as attachment
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="cmhoz" data-source="post: 403459" data-attributes="member: 31774"><p>Excellent....</p><p></p><p>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.</p><p></p><p>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."</p><p></p><p>This is the code:</p><p>[CODE]Public Sub MailSendMail(theBook As Workbook, _</p><p> recipient As String, subject As String)</p><p> Dim mailStr As String</p><p> </p><p> mailStr = _</p><p> "Tell application ""Mail""" & vbNewLine & _</p><p> "make new outgoing message with properties" & _</p><p> "{recipient:""" & recipient & """,subject:""" & subject & _</p><p> """,attachment:""" & theBook.FullName & """}" & vbNewLine _</p><p> & "move the result to out box folder" & vbNewLine & _</p><p> "send" & vbNewLine & _</p><p> "end tell"</p><p> </p><p> MacScript mailStr</p><p> </p><p> End Sub</p><p> </p><p> </p><p> Sub sendit()</p><p> MailSendMail ThisWorkbook, "jodcmh@bigpond.net.au", "this is the subject"</p><p> End Sub[/CODE]</p><p></p><p></p><p>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.</p><p></p><p>Thanks for any help... AppleScript is brand new to me.</p></blockquote><p></p>
[QUOTE="cmhoz, post: 403459, member: 31774"] 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[/CODE] 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. [/QUOTE]
Verification
What is Apple's smallest desktop computer called?
Post reply
Forums
Apple Computing Products:
macOS - Apps and Programs
Send Excel workbook as attachment
Top