Delete any redundant spaces at the end of footnotes

A

andreas

Dear Experts:

Is it possible to ask Word via VBA to delete any redundant spaces at
the very end of footnotes (that is all the footnotes should either end
with the last character of the respective word or a full stop and then
the paragraph mark should be the last "character").

Help is appreciated. Thank you very much in advance.

Regards,

Andreas
 
H

Helmut Weber

Hi Andreas,

perhaps like that:

Sub Makro4()
Dim rTmp As Range
Dim rFnt As Footnote
Set rTmp = ActiveDocument.Range
For Each rFnt In rTmp.Footnotes
While rFnt.Range.Characters.Last = " "
rFnt.Range.Characters.Last = ""
Wend
Next
End Sub

Setting a range to zero ("") avoids
the triggering of possible autocorrect options.
Also this method avoids the creation of an
additional paragraph mark, when trying
by search an replace to replace the last
paragraph mark in a story.
 
A

andreas

Hi Andreas,

perhaps like that:

Sub Makro4()
Dim rTmp As Range
Dim rFnt As Footnote
Set rTmp = ActiveDocument.Range
For Each rFnt In rTmp.Footnotes
   While rFnt.Range.Characters.Last = " "
   rFnt.Range.Characters.Last = ""
   Wend
Next
End Sub

Setting a range to zero ("") avoids
the triggering of possible autocorrect options.
Also this method avoids the creation of an
additional paragraph mark, when trying
by search an replace to replace the last
paragraph mark in a story.

Hey Helmut,

sorry for the delay in answering. As always, thank you very much for
your valuable help. I really appreciate it.
Regards, Andreas
 

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