View Single Post
 
Old 09-23-2019, 12:42 AM
KimJongUndo KimJongUndo is offline Mac OS X Office 2019
Novice
 
Join Date: Sep 2019
Posts: 4
KimJongUndo is on a distinguished road
Default Potential Other Error & Solution

I ran into an error that I had not seen before:

"Run-time error: '5941'

The document I'm working with had been converted from pdf to word and somehow, along the way (I presume it wasn't a conscious decision), what should have been superscripted characters (such as footnotes) where in fact actually only raised.

My jaw hit the floor as I realized the macro wouldn't work because, despite having upwards of 850 footnotes, the document did not contain a single superscript. Yet, I was staring at what looked like superscript on my screen. It was only through closer inspection of the font dialog box that I realized this wasn't word doing something completely idiosyncratic. And thankfully there's a solution.

The solution: advanced find & replace. Replacing raised text with the same text but not-raised and superscripted instead took care of the problem in short order. The find text will find any number and the replace text will replace it with itself. So the footnote number will be unharmed. The only difference is exactly what we want the formatting of those numbers to be.
Find: ([0-9]{1,})
Replace: \1
Advanced formatting described below:
IT IS CRUCIAL that "use wildcards" is checked, and that you go into the font formatting dialog for find (accomplish this by clicking into the find field and then altering the formatting stuff at the bottom of the advanced find & replace dialog box). In the font formatting, under the "advanced" tab, change the "Position" field from "normal" to "raised". You also have to enter a value for the amount the text is raised. This was not something my pdf converter had been consistent about but I found that most of my footnotes had been raised 3.5, 4, and 4.5 pts. I fully expect that I will have to run this find & replace a few more times when the macro breaks again because the footnotes were raised by some other amount—at least I now know where to look for that number!

It is also crucial that the replace text have the position "normal" and the superscript box checked (under the font tab within font formatting). In my case, the footnote text had not only been raised instead of superscripted but it was hilarious font sizes such as 5 pt instead of the size of the body text (11pt) so I made that change in the replace font formatting as well.
Reply With Quote