table with bold text

L

Laura

hi!
i have been trying to put in a table all the bold-text that there is in a
document, but i mustn't know very well how vba for word executes the 'find'
method (the result) because i'm unable to save it in my table correctly. Can
you help me please. if you want i give you the code. thanks a lot
 
D

Dave Lett

Hi Laura,

This might help:

Dim sBold As String
Dim oRngBold As Range

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = ""
.Font.Bold = True
Do While .Execute
sBold = sBold & Selection.Text & vbCrLf
Loop
End With
.HomeKey Unit:=wdStory
End With

Set oRngBold = Selection.Range
oRngBold.Text = sBold
oRngBold.Font.Bold = True
oRngBold.ConvertToTable


HTH,

Dave
 
Top