AW: Wortanzahl aus Word in Excel übertragen
28.02.2022 16:19:01
Herbert_Grom
Hallo Marek,
das habe ich dazu von Nepumuk gefunden:
Sub WoerterZaehlen()
Dim objWord As Object, objDocument As Object
Dim strText As String, lngIndex As Long
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDocument = objWord.Documents.Open("E:\xxx\xxx.docx")
strText = objDocument.Content.Text
objDocument.Close SaveChanges:=False
For lngIndex = 0 To 31
strText = Replace(strText, Chr$(lngIndex), Space$(1))
Next
Do While CBool(InStr(1, strText, Space$(2)))
strText = Replace(strText, Space$(2), Space$(1))
Loop
MsgBox UBound(Split(strText, Space$(1)))
objWord.Quit
Set objDocument = Nothing
Set objWord = Nothing
End Sub
Den Pfad und den Dateinamen musst du natürlich anpassen.
Servus