hallo torsten,
danke für dei Antwort.
ja R6 ist der pfad den habe ich kopiert, damit ich nicht falsches tippe, und o6 ist der Dateiname.
Habe das probiert. Sobald ich den Dateinamen ändere geht das makro nicht mehr und markiert mir die zeile:
Range("A1:L33").ExportAsFixedFormat Type:=xlTypePDF, Filename:=DateiName, OpenAfterPublish:=True
Ist da ein problem?
hier das makro
Sub pdfundsendenProduktion()
Dim DateiName As String
DateiName = Range("R6") & Range("O6") & ".pdf"
Range("A1:L33").ExportAsFixedFormat Type:=xlTypePDF, Filename:=DateiName, OpenAfterPublish:=True
Dim Outlook As Object
Dim outlookmailItem As Object
Dim myAttachments As Object
Set OutlookApp = CreateObject("outlook.application")
Set outlookmailItem = OutlookApp.CreateItem(0)
Set myAttachments = outlookmailItem.Attachments
With outlookmailItem
.to = Range("O9") & ";" & Range("P9")
.cc = Range("O10")
.Subject = Range("O14")
.body = Range("O15")
myAttachments.Add DateiName
.Display
End With
End Sub
|