ich hatte bereits einen Beitrag wo es darum ging per VBA eine Word Datei in PDF umzuwandeln und anschließend an eine email anzuhängen.
Nun bräuchte ich das ganze aber auch noch für eine Excel Datei.
Hab versucht das ganze umzuschreiben aber kommt Laufzeitfehler.
Wo liegt das Problem?
Dim strAttachment As String, strxlFile As String, strPDFFile As String
Dim objxl As Object, objxlFile As Object
strxlFile = "L:\06_Transportsteuerung\03_Construction\06_Transportplanung\01_Transportauftrag\ _
_
_
_
_
TA.xls"
strPDFFile = Left(strxlFile, InStrRev(strxlFile, ".") - 1) & ".pdf"
Set objxl = CreateObject("excel.Application")
Set objxlFile = objxl.Documents.Open(strxlFile)
objxlFile.ExportAsFixedFormat OutPutFileName:=strPDFFile, ExportFormat:=17
objxlFile.Close False
objxl.Quit
.Attachments.Add strPDFFile
Set objxlFile = Nothing
Set objxl = Nothing