Macro to turn squarebracket content into footnote

V

vjp2

I have a plain text file with hundreds of footnotes in square brackets
that I want to turn into MS Word footnotes


I'm kinda running out of time (measured in hours)

Whilei I've used BASIC form PDP Dartmouth to GW, I haven't a clue about VB.
 
K

Klaus Linke

Hi ???,

Quick and dirty:

Dim myRange As Range
Dim boolFound As Boolean
Dim myFootnote As Footnote
Set myRange = ActiveDocument.Content
Do
myRange.Find.ClearFormatting
With myRange.Find
.Text = "\[*\]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
myRange.Find.Execute
boolFound = myRange.Find.Found
If boolFound Then
myRange.Characters.Last.Delete
myRange.Characters.First.Delete
myRange.Cut
Set myFootnote = ActiveDocument.Content.Footnotes.Add( _
Range:=myRange)
myFootnote.Range.PasteAndFormat (wdPasteDefault)
Set myRange = ActiveDocument.Content
myRange.Collapse (wdCollapseStart)
Else
Exit Sub
End If
Loop

Regards,
Klaus
 
V

vjp2.at

My goodness.. thank you so much.. you
saved my neck!




- = -
Vasos-Peter John Panagiotopoulos II, Columbia'81+, Bio$trategist
BachMozart ReaganQuayle EvrytanoKastorian
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
Pataki+JebBush in 2008!
 
V

vjp2.at

Yes, it worked perfectly..



- = -
Vasos-Peter John Panagiotopoulos II, Columbia'81+, Bio$trategist
BachMozart ReaganQuayle EvrytanoKastorian
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
Pataki+JebBush in 2008!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top