View Single Post
 
Old 08-07-2022, 09:35 AM
BrianHoard BrianHoard is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jul 2022
Location: Haymarket, VA USA
Posts: 85
BrianHoard is on a distinguished road
Default

I think I've got it worked out. I saw mention on another forum from 2021 (sorry, didn't save the link) that there is a bug in Word when trying to modify character styles through a find. Of course, since this has to process every character in the document, is too slow to use on large docs. I'll continue to work on this so I don't have to check every character individually.
So I did this and it fixed it. The previous Endnote Reference is now Normal.
Code:
Sub test()
  ' Remove Endnote Reference character style
  
  Dim rngDoc As Range
  Dim rngChar As Range
  
  Set rngDoc = ActiveDocument.Range
  
  For Each rngChar In rngDoc.Characters
    If rngChar.Style = "Endnote Reference" Then
      rngChar.Font.Reset
      rngChar.Font.Superscript = True
     End If 'rngChar.Style
  Next rngChar

  For Each rngChar In ActiveDocument.Range.Characters
    Debug.Print (rngChar.Text & ", " & rngChar.Style)
  Next rngChar
End Sub
Result:
T, Normal
e, Normal
s, Normal
t, Normal
1, Normal
Pastes as superScript into website's rich text editor.
Reply With Quote