i tried my luck starting with this code, to export highlight text to a new excel file but i faced two problems
Sub ExportHighlightText()
Dim docCur As Document
Dim snt As Range
Dim Paragraphs As Range
Dim i As Integer
Dim appXL As excel.Application, xlWB As excel.Workbook, xlWS As excel.Worksheet
Dim path As XPath
Set appXL = CreateObject("Excel.Application")
appXL.Visible = True
Set xlWB = appXL.Workbooks.Add
Set xlWS = xlWB.Worksheets(1)
Application.ScreenUpdating = False
Set docCur = ActiveDocument
For Each snt In docCur.Sentences
If snt.HighlightColorIndex = wdBrightGreen Then
i = i + 1
xlWS.Cells(i, 1).Value = snt.Text
End If
Next snt
For Each snt In docCur.Sentences
If snt.HighlightColorIndex = wdYellow Then
i = i + 1
xlWS.Cells(i, 2).Value = snt.Text
End If
Next snt
ExitHandler:
Application.ScreenUpdating = True
Set snt = Nothing
Exit Sub
Resume ExitHandler
End Sub
first one it exports the text in column (B) but under other text in column (A) not opposite to it
1.jpg
second issue that it exports text as sentences and divide it to two lines not as paragraphs
2.jpg
and i'm still don't know how to get it back from excel to word with keeping same structure !!
Ethen