vielleicht habt Ihr ja eine Ahnung wieso dass nicht so will wie ich es brauch?
Also der Code stellt einfach nur einen Export der einzelnen Zeilen in Excel da (begrenzt auf Zeile 2 bis 11). Und alles wird dort gespeichert wo die Excel Datei liegt.
Jetzt das Problem:
Führe ich dieses Makro unter Office 2016 16.0.9330.2073 64 Bit mit MS VBA 7.1 auf einen Windows 10 Rechner aus, funktioniert er einwandfrei.
Führe ich aber nun das Makro, gleiche Datei in der Office Version (16.0.4639.1000) 32 Bit mit MS VBA 7.1 unter Windows 7 aus kommt die Fehlermeldung:
LaufzeitFehler 32809: Anwenndungs oder objektdefinierter Fehler
und er Markiert mir die Zeile "With .PageSetup"
Auch die Zeilen "BringThisWindowToTop=True" versteht er nicht.
Ich hab absolut keine Ahnung warum und hoffe auf eure Unterstützung
In der Userform:
Private Sub StartExport_Click()
Dim zeit As Date
Dim i As Integer
Dim j As Integer
Dim start As Date
start = Now()
Fortschritt.ProgressBar1.Max = 100
For i = 2 To 11
j = (10 / 100) * (i - 1) * 100
Fortschritt.ProgressBar1.Value = j
Fortschritt.Caption = (i - 1) & "fertig"
' BringThisWindowToTop = True
If Range("A" & i).Value = "" Then
GoTo A
End If
With ActiveSheet
With .PageSetup
.PrintTitleRows = "$1:$1"
.PrintArea = "A" & i & ":" & "L" & i
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'.PrintOut
'.PrintPreview
.ExportAsFixedFormat Filename:=ActiveWorkbook.Path & "\" & i & Range("A" & i), Type: _
=xlTypePDF
End With
GoTo A
A:
Next i
Application.DisplayAlerts = True
Application.Visible = True
Application.ScreenUpdating = True
zeit = Now() - start
MsgBox zeit
End Sub
Im Modul1:Sub ExportjedeZeile()
' Tastenkombination: Strg+j
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.Visible = False
Application.ScreenUpdating = True
Fortschritt.Show
End Sub