Uploaded August 2020 | Updated November 2026, 20 hours ago
How to use Power BI to perform data analysis and create data visualizations like dashboards quickly and easily.
How to use Power BI to perform data analysis and create data visualizations like dashboards quickly and easily.









![Extract Data from Word Document Using Word and Excel VBA
How to extract data from a Word document using both Word VBA and Excel VBA.
Heres the complete code:
Sub ExtractText()
Dim cDoc As Word.Document
Dim cRng As Word.Range
Dim i As Long
i = 2
Dim wordapp As Object
Set wordapp = CreateObject(word.Application)
wordapp.Documents.Open c:bracketdatabracket-data.docx
wordapp.Visible = True
Set cDoc = ActiveDocument
Set cRng = cDoc.Content
With cRng.Find
.Forward = True
.Text = [
.Wrap = wdFindStop
.Execute
Do While .Found
Collapses a range or selection to the starting or ending position
cRng.Collapse Word.WdCollapseDirection.wdCollapseEnd
cRng.MoveEndUntil Cset:=]
Cells(i, 1) = cRng
cRng.Collapse Word.WdCollapseDirection.wdCollapseEnd
.Execute
i = i + 1
Loop
End With
wordapp.Quit
Set wordapp = Nothing
End Sub
Option Explicit
Sub ExtractText()
Dim cDoc As Word.Document, nDoc As Word.Document
Dim cRng As Word.Range, nRng As Word.Range
Set cDoc = ActiveDocument
Set nDoc = Documents.Add
Set cRng = cDoc.Content
Set nRng = nDoc.Content
cRng.Find.ClearFormatting
With cRng.Find
.Forward = True
.Text = [
.Wrap = wdFindStop
.Execute
Do While .Found
cRng.Collapse Word.WdCollapseDirection.wdCollapseEnd
cRng.MoveEndUntil Cset:=], Count:=Word.wdForward
nRng.FormattedText = cRng.FormattedText
nRng.InsertParagraphAfter
nRng.Collapse Word.WdCollapseDirection.wdCollapseEnd
cRng.Collapse Word.WdCollapseDirection.wdCollapseEnd
.Execute
Loop
End With
End Sub
Reference:
https://social.msdn.microsoft.com/Forums/en-US/bbdc6c84-240e-43e1-aec9-402ca60c0c84/macro-code-help-extracting-text-between-brackets-from-word-file-into-a-new-file Extract Data from Word Document Using Word and Excel VBA](https://i.ytimg.com/vi/aIoMAtSYW_8/mqdefault.jpg)
