AW: Mehrseitiges Worddokument in Excel einbinden
11.06.2015 07:23:34
JoWE
Hallo Bernd,
da zeigt Dir die Recherche in diesem Forum und auch in Google unzählige Beispiele;
hier mal nur eines davon als Einstieghilfe:
Sub WordvorlageBefuellen()
'WICHTIG: Verweis auf Microsoft Word Library setzen
Dim wrd As Word.Application ' *
Set wrd = New Word.Application
Dim sPath As String
sPath = ActiveWorkbook.Path
If Not Right(sPath, 1) = "\" Then
sPath = sPath & "\"
End If
Dim doc As Word.Document
Set doc = Word.Documents.Open(sPath & "Vorlage.doc") 'Deine Wordvorlage
'Die Textmarken in der Wordvorlage ansteuern und mit den Daten aus Excel füllen
doc.Bookmarks.Item("Feld1").Range = Cells(1, 1).Text
doc.Bookmarks.Item("Feld2").Range = Cells(2, 1).Text
'Die Datei drucken
doc.PrintOut
'Die Datei speichern
doc.SaveAs sPath & "DeinDateiname" & Format$(Now(), "yyymmdd hhMMss") & ".docx"
'Die Datei schließen
doc.Close True
End Sub
Gruß Jochen