Zeilen einer Word-Datei in Excel einfügen
Hallo zusammen,
ich will ein Makro schreiben, welches die ersten 20 Zeilen eines Word-Dokuments in Excel einfügt.
Über Einfügen --> Objekt will es nicht funktionieren.
Wir benutzen Office 2016 bis Office 365.
Danke und Grüße aus dem Westerwald.
ich will ein Makro schreiben, welches die ersten 20 Zeilen eines Word-Dokuments in Excel einfügt.
Über Einfügen --> Objekt will es nicht funktionieren.
Wir benutzen Office 2016 bis Office 365.
Danke und Grüße aus dem Westerwald.
Please also mark the comments that contributed to the solution of the article
Content-Key: 91018079747
Url: https://administrator.de/contentid/91018079747
Printed on: May 5, 2024 at 03:05 o'clock
10 Comments
Latest comment
Sub ImportParagraphsFromWord()
Dim objDoc As Object
Dim i As Integer
With CreateObject("Word.Application")
.Visible = False
.DisplayAlerts = False
Set objDoc = .Documents.Open(ThisWorkbook.Path & "\test.docx")
' Loop through the first 20 paragraphs and copy the text to Excel
For i = 1 To 20
ThisWorkbook.Sheets("Tabelle1").Cells(i, 1).Value = objDoc.Paragraphs(i).Range.Text
Next i
objDoc.Close False
.DisplayAlerts = True
.Quit
End With
Set objDoc = Nothing
End Sub
Gruß schrick
Hier das Ergebnis meines Tests nach dem Ausführen des Skripts:
https://we.tl/t-RC4xIJzXwU
Works as designed .
https://we.tl/t-RC4xIJzXwU
Works as designed .