#16
|
||||
|
||||
With footnotes, you can only process them on one page at a time (i.e. you can't select them across multiple pages) and you have to select the footnotes concerned for processing.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
Having spent a lot of time on your code, I'm 99% sure that a punctuation mark must precede the footnote calling number to make it correctly work.
"This is a sentence.1 This" will work "This is a word1 followed by the rest of the sentence." will not work I read many English text where the footnote calling number is located at the end of a sentence, just after the period. Maybe this is a rule of thumb in English typography. (Is it ?) But in my native language, it is not ; footnote calling numbers can be anywhere in a sentence. |
#18
|
||||
|
||||
You're wrong about that - nothing in the code requires a preceding punctuation mark. Moreover, my code has nothing to do with typography conventions re footnote reference placement. It does not affect the footnote reference placement, so don't go blaming my code for what you consider a violation of a typography convention when the issue concerns the data you're processing. FWIW, the US convention (as is often the case) differs from the rest of the world. IIRC, I have posted code in other threads/forums for altering the footnote reference placement - but only insofar as whether the footnote reference occurs before or after a punctuation mark.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#19
|
|||
|
|||
Where did you see I was blaming your code ???????
I never wrote such a thing, moreover I never thought such a thing ! I'm always respectful with people sharing gtheir knowledge and developping skills. Who wrote about violation of typography convention ? Not me... I just ask a question... I don't understand why such a reaction... Quote:
|
#20
|
||||
|
||||
Well, it was you who wrote:
And that complaint has nothing to do with my code. Accordingly, it can only be understood as an unwarranted criticism or a complete irrelevance. You choose.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#21
|
|||
|
|||
I tried this macro. I pasted it in exactly as provided except, because my footnote numbers aren't bracketed or enclosed by anything else, I changed:
.Text = "\[([0-9]{1,})\]" to: .Text = "([0-9]{1,})" I also selected a group of footnotes at the bottom of a page. When I ran the macro, I got the same error message: Run-time error '13': Type mismatch I then clicked "debug" and it highlighted the following line in yellow: k = .Paragraphs(1).Range.Words(1) - 1 Did I do something wrong? Any advice what to try next? |
#22
|
||||
|
||||
If neither your footnote references in the body, nor your footnote references in the footnotes are bracketed, you need to change both:
.Text = "\[([0-9]{1,})\]" and: .Text = "[" & i & "]" to suit, as per the comments in the code. That said, if you did the same as the original poster who reported the "Run-time error '13': Type mismatch" error did, it's not surprising you're getting the same error.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
Type 13 error
A key feature of this macro is that it only requires you to select the actual text of the footnote. At first blush, I thought it was necessary to include the body of the text in which the footnotes occur BUT that is not the case. I too was getting a type 13 error but I figured out it was because I was misunderstanding how convenient the macro is.
In the example document: If you select the following text (which you might do if you thought the macro required the text of the footnote to be selected along with the footnote): "This is a sentence."1 This is a sentence. This is a sentence.2 This is a new paragraph. This is a sentence.3 This is a sentence.4 This is a sentence. 1 This is a footnote. 2 This is a footnote. 3 This is a footnote. 4 This is a footnote. You will get a type 13 error every time. That's because the macro actually uses the fact that the text of the footnote always begins with a number. But body text doesn't follow that convention. So the correct selection is: “This is a sentence.”1 This is a sentence. This is a sentence.2 This is a new paragraph. This is a sentence.3 This is a sentence.4 This is a sentence. 1 This is a footnote. 2 This is a footnote. 3 This is a footnote. 4 This is a footnote. This is a well-written and simple macro. |
#24
|
|||
|
|||
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,})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. |
#25
|
|||
|
|||
(@KimJongUndo: I am selecting only the footnote text.)
@macropod: Thank you. I changed both: .Text = "\[([0-9]{1,})\]" to: .Text = "([0-9]{1,})" and .Text = "[" & i & "]" to .Text = i But I still got the Run-time error '13': Type mismatch, with debugging highlighting in yellow: k = .Paragraphs(1).Range.Words(1) - 1 So I ran the advanced find and replace recommended by KimJongUndo and converted all nonsuperscript raised footnote callout numbers to nonraised superscripts (which yielded a lot of changes). Then reran the macro (still with the 2 above edits), and still got the same error with same line highlighted by debugger. I'm not an expert in macros. Did I do the edits correctly? |
#26
|
|||
|
|||
The other reason a type 13 error might happen is that you've got a paragraph return in your footnote where there shouldn't be one. It's one of those characters that's only visible if you show non-printing characters. You can show non-printing characters by hitting ctrl+shit+8. Now you should see dots for every space, an arrow for manual line breaks, and the paragraph mark at the end of every paragraph.
For example: 1 some footnote text.¶ 2 some more other footnote text.¶ The macro can parse the above perfectly. BUT, it will fail to parse this: 1 some footnote text.¶ 2 some more¶ other footnote text.¶ That's because it will see that second ¶ mark and think that's the end of footnote 2 and will then think the next paragraph (in the example, "other footnote text.¶") is a third footnote. The reason the macro fails is because it's expecting footnotes to begin with numbers. Since the third paragraph doesn't begin with a number, there's a type mismatch. The solution: Hit ctrl+shift+8 to show non-printing characters and change that second ¶ (and any others like it) to a manual line break. Hit shift+enter to create a manual line break. Lines broken up with line breaks are still part of the same paragraph to word, which is why the macro will work again because now it doesn't think the third line is another footnote. |
#27
|
|||
|
|||
Thank you, I did find some carriage returns within footnotes. I deleted those and reran the macro as above and still got the same error message.
|
#28
|
|||
|
|||
The only other way that I can think of a type 13 error would occur is if you've got anything other than a space after your footnote number in the footnote text.
For example: 1 adhidnads in asdifnidsfn Will work well but: 1] asdnin idsne i sdf or 1A. Schwarzenegger asdinvie dinsve will create a type 13 error. The macro does provide for ways of removing standard formatting (such as going from [1] -> 1) but my pdf conversion isn't consistent about spacing so I've had a situation where the space after the footnote number disappeared and it threw everything off. Might that be what's happening to you? |
#29
|
||||
|
||||
Quote:
Find = ^# with the find font set to the appropriate raised value, and Replace = ^& with the replacement font set to superscript and normal (not raised). Wildcards not needed.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#30
|
||||
|
||||
Do you have a space character after each footnote reference in the document body? As the notes in post 2 indicate, that is a requirement.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word footnotes and track changes problem | Carnegie | Word | 14 | 03-13-2017 01:31 AM |
Convert manual cross references in footnotes to other footnotes to automatic cross references | ghumdinger | Word VBA | 7 | 11-20-2014 11:47 PM |
word 2007 - footnotes and text box | glggluig | Word | 1 | 08-10-2014 04:09 AM |
Corrupted footnotes in Word | mythander889 | Word | 12 | 09-11-2012 03:58 PM |
Can Word automatically update footnotes? | gib65 | Word | 2 | 08-15-2011 01:46 PM |