Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1548to1552
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Makro anpassen

Makro anpassen
06.04.2017 11:26:56
Andre
Hallo zusammen,
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

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Makro anpassen
06.04.2017 12:39:02
Anton2
Hallo Andre,
Sub SaveMailActiveSheetAsPDFIn2016()
'Ron de Bruin : 1-May-2016
'Test macro to save/mail the Activesheet as pdf with ExportAsFixedFormat with Mail
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
FilePathName = "C:\Folder\File.pdf" 'Den Pfad auf Deine File ändern
'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", _ 'Hier Deine Adresse eintragen
ccaddress:="", _
bccaddress:="", _
attachment:=FilePathName, _
displaymail:=True, _
thesignature:="", _
thesender:=""
End Sub
Funktioniert das?
VG Anton
Anzeige
AW: Makro anpassen
07.04.2017 11:44:41
Andre
Hallo Anton ich füge bei
FilePathName =/Users/HoffesMac ein,
dann kommt bei mir "Fehler beim drucken"
er öffnet keine Mail und speichert auch nichts mehr.
Gruß Andre

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige