Sub
Rechnung_Generieren()
Dim
sPfad
As
String
, sFilename
As
String
Dim
oBer
As
Range, WSh
As
Worksheet
Dim
i
As
Integer
sPfad = "C:\Users\b1bya\Google Drive\NOST_CRM\"
Set
WSh = ThisWorkbook.Sheets(
"Verrechnungen"
)
For
i = 2
To
3
With
ThisWorkbook.Sheets(
"RGTemplate"
)
.Cells(18, 5).Value = WSh.Cells(i, 1).Value
sFilename =
"invoice"
& WSh.Cells(i, 1).Value &
".pdf"
Set
oBer = .Range(
"A1:J"
& .Cells(Rows.Count, 1).
End
(xlUp).Row)
oBer.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sPfad & sFilename, _
quality:=xlQualityStandard, includedocproperties:=
True
, _
ignoreprintareas:=
True
, openafterpublish:=
False
End
With
Next
i
MsgBox
"Erledigt"
, vbInformation,
"PDF-Export"
End
Sub