|  
                                             Guten Morgen 
Wie kann ich die Excelvorlage direkt mit dem untenstehenden Makro als PDF Datei in den Zielordner speichern? 
Mit  
Call ThisWorkbook.SaveAs(Filename:=strFolder & strSubFolder & "\" & _ 
                    strFile, FileFormat:=xlTypePDF) 
geht es leider nicht. 
 
Freue mich auf eure Hilfe. 
Gruss 
ch79 
  
Public Sub SaveSpecial() 
    Const FOLDER_PATH As String = "L:\01_P_#\01_A_#\" 
    Dim lngYear As Long, lngReturn As Long 
    Dim strFolder As String, strSubFolder As String, strValue As String, strFile As String 
    Dim blnFound As Boolean 
    strValue = Split(Cells(10, 3).Text, "-")(0) 
    strFile = Cells(10, 3).Text 
    For lngYear = Year(Date) - 1 To Year(Date) + 1 
        strFolder = Replace(FOLDER_PATH, "#", CStr(lngYear)) 
        lngReturn = MakeSureDirectoryPathExists(strFolder) 
        If lngReturn = 0 Then 
            Call MsgBox("Ordner kann nicht erstellt werden.", vbCritical, "Dateisystemfehler") 
            Exit Sub 
        Else 
            strSubFolder = Dir$(strFolder & strValue & "*", vbDirectory) 
            If strSubFolder <> vbNullString Then 
             If InStr(1, ThisWorkbook.Name, "_") = 0 Then 
                    strFile = strFile & "_" & ThisWorkbook.Name 
                Else 
                    strFile = strFile & "_" & Split(ThisWorkbook.Name, "_")(1) 
                End If 
                Call ThisWorkbook.SaveAs(Filename:=strFolder & strSubFolder & "\" & _ 
                    strFile, FileFormat:=xlOpenXMLWorkbookMacroEnabled) 
                blnFound = True 
                Exit For 
            End If 
        End If 
    Next 
    If Not blnFound Then 
        Call MsgBox("Ordner ''" & strValue & _ 
            "'' nicht gefunden.", vbCritical, "Datei nicht gespeichert") 
'Makro schliessen nach speichern unter: 
            'Else 
       ' If Workbooks.Count = 1 Then Call Application.Quit Else Call ThisWorkbook.Close 
    End If 
End Sub 
     |