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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top