I am having some difficulty with this solution: http://answers.microsoft.com/en-us/office/forum/office_2010-word/convert-footnote-to-inline-citation/6e2cc6cc-add0-4af9-abc0-1c6e14e9c7ac
I am currently using the VBA macro below to convert a word doc's footnotes into in-text citations to be used within wordpress. The resulting text needs to be copy/pasted into wordpress. The [ref] tags seen in the code are to enable wordpress to read the text as citations.
Sub foot2inline() Dim oFeets As Footnotes Dim oFoot As Footnote Dim oRange As Range Dim szFootNoteText As String ' Grabs the collection of FootNotes Set oFeets = Word.ActiveDocument.Footnotes ' Iterates through each footnote For Each oFoot In oFeets szFootNoteText = oFoot.Range.Text 'Start search from beginning of document Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting With Selection.Find .Text = "^f" ' Looks for all footnotes .Forward = True .Wrap = wdFindStop End With Selection.Find.Execute ' Delete the footnote oFoot.Delete 'Insert the footnote text 'Here you do whatever format tickles your fancy Selection.Text = " [ref] " + szFootNoteText + "[/ref] " 'CHANGE COLOR HERE. Color code is below. Selection.Font.Color = 6299648 'Disables undo to save memory on very large documents. ActiveDocument.UndoClear Next End Sub
I have two issues I need resolved:
- When the footnote is moved into the text, I lose all formatting (italicization, small/large caps, etc). It is crucial that formatting is preserved because the footnotes are legal (bluebook) citations and the formatting is essential. Toggling the Selection.Find.ClearFormatting does not do the trick.
- The result of the macro puts a weird box after the [ref] but before the footnote's text. I suspect that this is a remnant of the numbering within footnotes. This box cannot be present after the macro runs.
Ideally this needs to run in both Office and Office for Mac.
Any suggestions, tips, or references would be much appreciated!