Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29904

VBA | Send range to email as PNG/JPEG - MacOS

$
0
0

I was working on this script from https://www.rondebruin.nl/mac/mail.htm to try to output a JPEG/PNG from a selection range. Currently it outputs only HTML code onto the email, therefore pictures and shapes are lost.

Would anyone know to make it work? Specifically I need it to work on a MacBook. I have a windows version that works well, but the code (inc. libraries) becomes more cumbersome in Mac.

Option Explicit

Sub CommandButton1_Click()
    Dim strbody As String
    Dim HTMLMac As String

    'Exit the sub if it is Mac Excel 2011 or lower
    If Val(Application.Version) < 15 Then Exit Sub

    'Check if the AppleScriptTaskExcelScriptFile is in the correct location
    If CheckAppleScriptTaskExcelScriptFile(ScriptFileName:="RDBMacOutlook.scpt") = False Then
        MsgBox "Sorry the RDBMacOutlook.scpt file is not in the correct location" _

        Exit Sub
    End If

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    'Create the htm file and read the html code in the string
    HTMLMac = RangetoHTMLMac(ActiveSheet.Range("D21:L62"))

    'Call the MailWithMacOutlook2016Body function to create the mail
    'When you use more mail addresses separate them with a ,
    'Change yes to no in the displaymail argument to send directly
    'Look in Outlook>Preferences for the type and name of the account that you want to use
    'If accounttype is empty it will use the default mail account, accounttype can be pop or imap
    'Note: It will use the signature of the account that you choose
    MailWithMacOutlook2016Body _
    subject:="Report "& Date, _
    mailbody:=HTMLMac, _
    toaddress:="na@na.com", _
    ccaddress:="", _
    bccaddress:="", _
    displaymail:="yes", _
    accounttype:="", _
    accountname:=""

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
End Sub

Thank you!


Viewing all articles
Browse latest Browse all 29904

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>