Range start and end in Word footnotes

M

m rafala

In a Word macrop, I am used to doing Selection.Find, and then doing various
things to the found text. I keep track of where I am with Selection.Start
and Selection.end, and also such things as
ActiveDocument.range(Selection.Start + 5, Selection.End - 1), etc.

I now need to do lots of work with very long Footnotes. I can find things by
using the Footnotes Story, but Selection.Start and End seem to refer to the
main Story, not my selection in the Footnote story.

Does this make sense? How can I do the following, but in the footnotes
section:

Selection.find.execute .... "my text"
ActiveDocument.Range(selection.start +2, selection.end -2).select
selection.font.italic = true
 
K

Klaus Linke

Maybe try to work with a Range...

Set it to the footnote's range initially, then manipulate it as necessary:
Dim rngFN as Range
Set rngFN=Selection.Footnotes(1).Range.Duplicate
....


You can loop all footnotes:
Dim fn as footnote
For each fn in ActiveDocument.Footnotes
Set rngFN=fn.Range.Duplicate
...
Next fn


As you single-step through the macro while testing it (F8), you can select
rngFN to check whether you set it correctly:
Ctrl+G gets you into the immediate window,
rngFN.Select

If that doesn't help, maybe explain what exactly you need to do with very
long footnotes.


Regards,
Klaus
 

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