I'm finished. The Rest is finetuning.
Thanks Macropod, I couldn't have done it without your tips.
As promised, here's the code:
Private Sub Button_Convert_Click()
'Prüfe Datei auf Existenz
If TextBox_ExcelPath.Text = "" Then
MsgBox "Keine Datei definiert. Abbruch"
Exit Sub
End If
If Dir(TextBox_ExcelPath.Text) = "" Then
MsgBox "Datei " & TextBox_ExcelPath.Text & " nicht vorhanden. Abbruch"
Exit Sub
End If
Dim oConvWB As Workbook
Set oConvWB = Workbooks.Open(TextBox_ExcelPath.Text)
Const wdPageBreak As Long = 7
Const wdLineBreak As Long = 6
'Lade Datei und wandle um
Dim AppWord As Object
Set AppWord = CreateObject("Word.Application")
Dim AppWdDoc As Object
Set AppWdDoc = AppWord.Documents.Add
AppWord.Visible = True
oConvWB.Sheets("Header").Select
AppWdDoc.PageSetup.DifferentFirstPageHeaderFooter = False
oConvWB.Sheets("Header").Range(Cells(23, 1), Cells(25, 6)).Copy
AppWdDoc.Sections(1).Headers(1).Range.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=False
AppWdDoc.Fields.Add Range:=AppWdDoc.Sections(1).Headers(1).Range.Tables(1).Cell(3, 4).Range.Characters.First, Type:=-1, Text:="PAGE", PreserveFormatting:=False
oConvWB.Sheets("Header").Range(Cells(29, 1), Cells(31, 1)).Copy
AppWdDoc.Sections(1).Headers(1).Range.PasteSpecial Link:=False, Placement:=1, DisplayAsIcon:=False, DataType:=9
oConvWB.Sheets("Header").Range(Cells(27, 1), Cells(27, 6)).Copy
AppWdDoc.Sections(1).Footers(1).Range.Paste
AppWdDoc.PageSetup.DifferentFirstPageHeaderFooter = True
oConvWB.Sheets("Header").Range(Cells(2, 1), Cells(12, 6)).Copy
AppWdDoc.Sections(1).Headers(2).Range.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=False
AppWdDoc.Fields.Add Range:=AppWdDoc.Sections(1).Headers(2).Range.Tables(1).Cell(3, 4).Range.Characters.First, Type:=-1, Text:="PAGE", PreserveFormatting:=False
oConvWB.Sheets("Header").Range(Cells(29, 1), Cells(31, 1)).Copy
AppWdDoc.Sections(1).Headers(2).Range.PasteSpecial Link:=False, Placement:=1, DisplayAsIcon:=False, DataType:=9
oConvWB.Sheets("Header").Range(Cells(29, 1), Cells(31, 1)).Copy
AppWdDoc.Sections(1).Headers(2).Range.PasteSpecial Link:=False, Placement:=1, DisplayAsIcon:=False, DataType:=9
oConvWB.Sheets("Header").Range(Cells(14, 1), Cells(21, 6)).Copy
AppWdDoc.Sections(1).Footers(2).Range.Paste
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S1").Select
oConvWB.Sheets("S1").Range(Cells(1, 1), Cells(21, 8)).Copy
AppWord.Selection.Paste
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S2").Select
oConvWB.Sheets("S2").Range(Cells(1, 1), Cells(1, 1)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
oConvWB.Sheets("S2").Range(Cells(3, 1), Cells(3, 8)).Copy
AppWord.Selection.Paste
oConvWB.Sheets("S2").Range(Cells(5, 1), Cells(38, 8)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S3").Select
oConvWB.Sheets("S3").Range(Cells(1, 1), Cells(14, 5)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S4").Select
oConvWB.Sheets("S4").Range(Cells(1, 1), Cells(38, 7)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S5").Select
oConvWB.Sheets("S5").Range(Cells(1, 1), Cells(30, 5)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S6").Select
oConvWB.Sheets("S6").Range(Cells(1, 1), Cells(34, 8)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S7").Select
oConvWB.Sheets("S7").Range(Cells(1, 1), Cells(11, 11)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S8").Select
oConvWB.Sheets("S8").Range(Cells(1, 1), Cells(53, 7)).Copy
AppWord.Selection.Paste
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S9").Select
oConvWB.Sheets("S9").Range(Cells(1, 1), Cells(52, 7)).Copy
AppWord.Selection.PasteSpecial Placement:=0, DataType:=0
AppWdDoc.Characters.Last.Select
AppWord.Selection.InsertBreak wdPageBreak
AppWdDoc.Characters.Last.Select
oConvWB.Sheets("S10").Select
oConvWB.Sheets("S10").Range(Cells(1, 1), Cells(2, 2)).Copy
AppWord.Selection.PasteExcelTable _
LinkedToExcel:=False, _
WordFormatting:=False, _
RTF:=True
'Excel schließen
oConvWB.Saved = True
oConvWB.Close
'Speicherpfad prüfen und speichern
Set oFS = CreateObject("Scripting.FileSystemObject")
Dim SavePath As String
SavePath = oFS.GetParentFolderName(TextBox_ExcelPath.Text) & "" & oFS.GetBaseName(TextBox_ExcelPath.Text) & ".docx"
Set oFS = Nothing
AppWord.Visible = True
If Dir(SavePath) = "" Then
AppWord.ActiveDocument.SaveAs2 Filename:=SavePath
AppWord.Quit
Else
iResult = MsgBox("Zieldatei vorhanden. Überschreiben?", vbYesNo)
If iResult = 6 Then
AppWord.ActiveDocument.SaveAs2 Filename:=SavePath
AppWord.Quit
Else
AppWord.Visible = True
End If
End If
End Sub