![]() |
#1
|
|||
|
|||
![]()
I am looking for a way to remove any trailing spaces from all footnotes.
I thought I would try to iterate through them and check if the last character was a space (or other) and delete it, but this isn't working. It also throws a "Cannot edit Range" Error if the last character of a footnote is within a Hyperlink's text (blue and underlined) and is a space. What is the right way to approach this? Footnotes can have multiple hyperlinks and the last character may be within one of them and be a space or other character I want rid of? I've also tried just .Find'ing within the footnote's range, but I can't seem to only remove the trailing space(s). Some sample code that fails: Code:
For i = 1 To ActiveDocument.Footnotes.Count Dim fn As Object Set fn = ActiveDocument.Sections(1).Range.Footnotes(i) myMax = fn.Range.Characters.Count For j = myMax To 1 Step -1 myChar = fn.Range.Characters(j) If myChar = Chr(32) Then myLong = fn.Range.Characters(j).Delete 'This fails if last char is space within a hyperlink Else Exit For End If Next Next |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
faustino909 | Word VBA | 2 | 08-03-2018 01:34 PM |
![]() |
LearnerExcel | Excel Programming | 8 | 02-04-2018 08:22 PM |
![]() |
Tonykiwi | Excel | 4 | 11-06-2016 09:30 PM |
![]() |
osucjb | Mail Merge | 5 | 10-28-2016 12:03 AM |
Word-Help with removing unwanted spaces in text | greshoff | Word | 9 | 12-30-2011 03:24 PM |