> You have a dog's breakfast of a document. Sorry.
> You have a dog's breakfast of a document. Sorry.
>
[quoted text clipped - 34 lines]
> >
> > Ed
Hi Ed,
at a very long shot,
you could record properties of the selection,
like font-properties,
by selecting a piece of text, call the format-font dialog,
hit [return], apply the so determined formatting,
which doesn't do anyhting,
search another piece of text, or move the cursor to it,
and hit [F4].
In Code:
' formatting was recorded before!
Sub Macro22()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "ck"
While .Execute
rDcm.Select
Repeat (1)
Wend
End With
End Sub
... which didn't work without selection, alas.
I guess, one could record paragraph formatting
and formatting of bullets and numbering in the same way,
and apply it programmatically to found pieces of text.
HTH

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Ed - 28 Feb 2006 21:39 GMT
I thought about using CopyFormat and PasteFormat - select the text, Copy
Format, set it to a Style name, then PasteFormat to return it to what it
was. The other half of the problem is how to capture the page number of the
text. The Table of Contents is already in a table. I could iterate through
the table, select the section title text in a cell, Find the text in the
document with the designated Style, get the page number and write it into
the table at same row, next column.
Returning the page number was the big problem. The only thing I could thing
of was to collapse my Find selection, insert a PageNumber field, get the
returned number, then delete the field. Do-able, and no problem for VBA -
just a bunch of extra junk and possibly causing doc repagination and slowing
things down.
Ed
> Hi Ed,
>
[quoted text clipped - 30 lines]
>
> HTH