jerry0110
Erfahrenes Mitglied
Hallo zusammen,
ich habe ein Problem mit dem Zufügen von einer Datei, wenn ich eine Email durch VBA erstellen lasse.
Es kommt immer, wenn es um die "strExcel" geht eine Fehlermeldung.
Die Fehlermeldung lautet:
Laufzeitfehler '-2147024829 (80070043)'
Fehler beim ausführen der Operation.
ich habe ein Problem mit dem Zufügen von einer Datei, wenn ich eine Email durch VBA erstellen lasse.
Visual Basic:
Sub Email_versenden()
Dim strPDF As String
Dim strPDF2 As String
Dim strExcel As String
Dim OutlookApp As Object, strEmail As Object
myDate = ThisWorkbook.Worksheets("Dashboards").Range("Z1")
Set OutlookApp = CreateObject("Outlook.Application")
Set strEmail = OutlookApp.CreateItem(0)
ThisWorkbook.Sheets(Array("Detaillansicht Aufträge VR", "Detailansicht Angebote VR", "Detailansicht Verkaufsbesuch VR", "Detailansicht Telefonate VR_TS", "Detail. Termintage_Forecast")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\" & Format(myDate, "mmmm") & "\" & Format(myDate, "YYYY_MM") & "_Auswertung KPI Ambulante Pflege " & Format(myDate, "YYYY") & " Detaillierte Auswertung.pdf", Quality:=xlQualityStandard _
, IncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish _
:=False
ThisWorkbook.Sheets("Dashboards").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\" & Format(myDate, "mmmm") & "\" & Format(myDate, "YYYY_MM") & "_Auswertung KPI Ambulante Pflege " & Format(myDate, "YYYY") & ".pdf", Quality:=xlQualityStandard _
, IncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish _
:=False
strPDF = ThisWorkbook.Path & "\" & Format(myDate, "mmmm") & "\" & Format(myDate, "YYYY_MM") & "_Auswertung KPI Ambulante Pflege " & Format(myDate, "YYYY") & " Detaillierte Auswertung.pdf"
strPDF2 = ThisWorkbook.Path & "\" & Format(myDate, "mmmm") & "\" & Format(myDate, "YYYY_MM") & "_Auswertung KPI Ambulante Pflege " & Format(myDate, "YYYY") & ".pdf"
strExcel = "\\oda-san1\GVL\ASS\Vertriebscontrolling\KPI´s\Forecast\" & Format(myDate, "YYYY") & "\" & Format(myDate, "mmmm") & "\Forecast AMB " & Format(myDate, "mmmm YYYY") & ".xlsx"
With strEmail
.To = ""
.CC = ""
.Subject = "KPI Auswertung AMB " & Format(myDate, "mmmm YYYY")
.body = ""
.Attachments.Add strPDF
.Attachments.Add strPDF2
.Attachments.Add strExcel
.Display
End With
Set OutlookApp = Nothing
Set strEmail = Nothing
End Sub
Es kommt immer, wenn es um die "strExcel" geht eine Fehlermeldung.
Die Fehlermeldung lautet:
Laufzeitfehler '-2147024829 (80070043)'
Fehler beim ausführen der Operation.