Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Adelaide, South Australia, Australia
    Posts
    146
    Thanks
    5
    Thanked 5 Times in 5 Posts

    Accessing Footnote text using VBA

    I never know whether to post questions like this under the relevant application or in the VBA section, so here goes.

    I have a client who has 1745 footnotes, all created using the default (and extremely flakey) footnote format that comes with Microsoft Word. She asked me to help fix the indenting, and it was a cinch to show her how to set up the format with a hanging indent and tab.

    Problem is that the existing 1745 footnotes all have a space between the number and the footnote text, and I want to replace it with a tab.

    Started looking in VBA for a way to do so - can loop through all the footnotes, but there doesn't seem to be any way to access the text for existing footnotes.

    Searched this forum, and the most recent post I could find suggests that the only way to access this text via VBA is at the time when the footnote is added.

    Really? Is there no way of accessing the existing 1745 footnotes (no, honestly, it wasn't me who created them - I would have known how to get the formatting right from the start!) simply to replace the starting space with a tab?

    I am using Office 2010 (which is where I am looking for help ATM), but my client is using 2003 (I haven't checked the VBA procedure on her PC, but can do so if the old version can do it where the latest can't - just didn't want to waste time on site if I can fix it before I go there).

    Any help would be greatly appreciated.

    Cheers

    Alison C

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    The VBA to post-process all the footnotes this way is shown below.
    Code:
      Dim aFN As Footnote
      For Each aFN In ActiveDocument.Footnotes
        aFN.Range.Text = vbTab & aFN.Range.Text
      Next aFN
    Last edited by Andrew Lockton; 2011-04-04 at 18:21.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    alifrog (2011-04-04)

  4. #3
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Adelaide, South Australia, Australia
    Posts
    146
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Thankyouthankyouthankyou, Andrew - I had everything except the .Range bit - I had mistakenly thought that .Range related to the range to which the footnote referred, and having tried so many combinations and permutations I missed that one.

    Job is now done, and client will be very, very happy not to have to manually fix 1745 footnotes!

    Now I just have to figure out how to give you a thumbs-up for your prompt and supremely helpful response...

    Cheers

    Alison C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •