Hallo zusammen,
ich benötige eure Hilfe. Ich habe eine Arbeitsmappe mit 6 Arbeitsblättern und will ein Makro schreiben um auf Klick alle 29 Einheiten aus der Dropdownliste als PDF's in einen Ordner zu exportieren. Für eine Einheit aus der Dropdownliste müssen immer zwei Arbeitsblätter kombiniert werden.
Mein bisheriger Code sieht so aus:
Sub printPDFs()
Const fileRef = "B1" 'export Folder Name
Const title = "A1" 'title fo PV plant
Dim exportFolder As String 'name of folder to store files
Dim exportName As String 'name of file to export
Dim PVplant As String
Dim i As Integer 'loop-counter
Dim ll As Integer 'length of list
'obtain folder name for storage and create if it doesn't exist
exportFolder = Sheets("Lists").Range(fileRef).Value
' initialize
Sheets("pant_monthly" , "daily_overview").Select
i = 2
' loop all PVplants
While ((Len(Sheets("Lists").Cells(i, 1).Value) > 0) And (i < 1000))
'read name of PV plant
PVplant = Sheets("Lists").Cells(i, 1).Value
Range(title).Value = PVplant
' kick out forbidden symbols
PVplant = Replace(PVplant, "/", "")
exportName = exportFolder & "\" & PVplant
exportName = Replace(exportName, Chr(10), "")
exportName = Replace(exportName, Chr(34), "-")
' store pdf
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=exportName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
i = i + 1
Wend
End Sub
Kann mir hier jemand helfen??
LG
ich benötige eure Hilfe. Ich habe eine Arbeitsmappe mit 6 Arbeitsblättern und will ein Makro schreiben um auf Klick alle 29 Einheiten aus der Dropdownliste als PDF's in einen Ordner zu exportieren. Für eine Einheit aus der Dropdownliste müssen immer zwei Arbeitsblätter kombiniert werden.
Mein bisheriger Code sieht so aus:
Sub printPDFs()
Const fileRef = "B1" 'export Folder Name
Const title = "A1" 'title fo PV plant
Dim exportFolder As String 'name of folder to store files
Dim exportName As String 'name of file to export
Dim PVplant As String
Dim i As Integer 'loop-counter
Dim ll As Integer 'length of list
'obtain folder name for storage and create if it doesn't exist
exportFolder = Sheets("Lists").Range(fileRef).Value
' initialize
Sheets("pant_monthly" , "daily_overview").Select
i = 2
' loop all PVplants
While ((Len(Sheets("Lists").Cells(i, 1).Value) > 0) And (i < 1000))
'read name of PV plant
PVplant = Sheets("Lists").Cells(i, 1).Value
Range(title).Value = PVplant
' kick out forbidden symbols
PVplant = Replace(PVplant, "/", "")
exportName = exportFolder & "\" & PVplant
exportName = Replace(exportName, Chr(10), "")
exportName = Replace(exportName, Chr(34), "-")
' store pdf
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=exportName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
i = i + 1
Wend
End Sub
Kann mir hier jemand helfen??
LG