R
Raj
When reading a document, I highlight important/interesting text. I
later extract these highlighted portions to another document using the
following code (from the Web):
Sub ExtractHighlightedText
Dim oDoc As Document
Dim s As String
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = ""
.Highlight = True
Do While .Execute
s = s & Selection.Text & vbCrLf
Loop
End With
End With
Set oDoc = Documents.Add
oDoc.Range.InsertAfter s
End sub
However, the text is copied without any formatting. I want the
original formatting to be retained. How can I do this?
Thanks in advance for the help.
Regards,
Raj
later extract these highlighted portions to another document using the
following code (from the Web):
Sub ExtractHighlightedText
Dim oDoc As Document
Dim s As String
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = ""
.Highlight = True
Do While .Execute
s = s & Selection.Text & vbCrLf
Loop
End With
End With
Set oDoc = Documents.Add
oDoc.Range.InsertAfter s
End sub
However, the text is copied without any formatting. I want the
original formatting to be retained. How can I do this?
Thanks in advance for the help.
Regards,
Raj