ich habe mir folgendes Makro von eine Webseite geladen und möchte dieses nun anwenden.
Es ist allerdings ein Makro für Mac OS Excel 2016 .
Ich habe schon den Betreff geändert und den Text der eingefügt werden soll.
Nun möchte ich aber noch die Empfängeradresse eintragen, denn diese ist immer gleich und es soll das aktuelle Tabellenblatt als PDF angehangen werden.
Muss ich bei allen Dim angaben etwas eintragen?
Wo wird die PDF gespeichert?
Ich habe aber keine Ahnung wo ich das in dem Makro eintragen soll, habe so gut wie keine Ahnung davon.
Vielleicht kann mir jemand dabei helfen auch wenn es für den Mac ist.
hier das Makro
Option Explicit
Sub SaveMailActiveSheetAsPDFIn2016()
'Ron de Bruin : 1-May-2016
'Test macro to save/mail the Activesheet as pdf with ExportAsFixedFormat with Mail
Dim FileName As String
Dim FolderName As String
Dim Folderstring As String
Dim FilePathName As String
Dim strbody As String
'Check for AppleScriptTask script file that we must use to create the mail
If CheckAppleScriptTaskExcelScriptFile(ScriptFileName:="RDBMacMail.scpt") = False Then
MsgBox "Sorry the RDBMacMail.scpt is not in the correct location"
Exit Sub
End If
'My example sheet is landscape, I must attach this line
'for making the PDF also landscape, seems to default to
'xlPortait the first time you run the code
ActiveSheet.PageSetup.Orientation = xlLandscape
'Name of the folder in the Office folder
FolderName = "TempPDFFolder"
'Name of the pdf file
FileName = Format(Now, "hh-mm-ss") & ".pdf"
Folderstring = CreateFolderinMacOffice2016(NameFolder:=FolderName)
FilePathName = Folderstring & Application.PathSeparator & FileName
'Create the body text in the strbody string
strbody = "Hallo zusammen," & vbNewLine & vbNewLine & _
"Hier sind die Stunden der letzten Woche." & vbNewLine & _
"KW" & vbNewLine & _
"Gruß Andre"
'expression A variable that represents a Workbook, Sheet, Chart, or Range object.
'Not working if you change activeworkbook, always save the activesheet
'Also the parameters are not working like in Windows
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
FilePathName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False
'Call the MacExcel2016WithMacMailPDF
Function to save the new pdf and create the mail
'When you use more mail addresses separate them with a ,
'Look in Mail>Preferences for the name of the mail account or signature
'Account name looks like this : "Your Name "
MacExcel2016WithMacMailPDF subject:="Stunden der letzten Woche", _
mailbody:=strbody, _
toaddress:="ron@debruin.nl", _
ccaddress:="", _
bccaddress:="", _
attachment:=FilePathName, _
displaymail:=True, _
thesignature:="", _
thesender:=""
End Sub