From: CJ on
I just ran into one from an outside source where the footnote text is
preceded by a space and a tab, and the macro hangs there.

It looks like this is something we will have to start dealing with, because
we will be working with that outside source pretty frequently and must be
able to change it.

Any advice on how to do that?

"CJ" wrote:

> You know what? You are absolutely awesome! Thank you for such quick and
> expert help. It works exactly like I need it to.
>
> "DaveLett" wrote:
>
> > Hi CJ,
> > The provided routine accounts for that case with this line:
> >
> > '''insert two spaces before each footnote 'text'
> > oRng.InsertBefore Text:=" "
> >
> > Notice that this line comes after the closing "Loop" for removing
> > characters; therefore, the routine inserts two spaces before EVERY footnote.
> >
> > HTH,
> > Dave
> >
> > "CJ" wrote:
> >
> > > Dave, this is beautiful! Thank you so much! Do you have any idea whether
> > > there is a way to deal with the instance where there is no space before the
> > > footnote text?
> > >
> > > "DaveLett" wrote:
> > >
> > > > Hi CJ,
> > > > I think you're looking for something like the following:
> > > >
> > > > Dim lFoot As Long
> > > > Dim sFoot As String
> > > > Dim oRng As Range
> > > >
> > > > For lFoot = 1 To ActiveDocument.Footnotes.Count
> > > > Set oRng = ActiveDocument.Footnotes(lFoot).Range.Paragraphs(1).Range
> > > > oRng.MoveStart unit:=wdCharacter
> > > > '''as long as the first character of the footnote is a space
> > > > '''or tab, delete that first character
> > > > Do While Left(oRng.Text, 1) = " " Or Left(oRng.Text, 1) = vbTab
> > > > oRng.Characters(1).delete
> > > > Loop
> > > > '''insert two spaces before each footnote 'text'
> > > > oRng.InsertBefore Text:=" "
> > > > Next lFoot
> > > >
> > > > HTH,
> > > > Dave