Share via

Macro for Endnotes

Anonymous
2013-03-25T04:13:37+00:00

Greetings!

Because I am unable to create a macro by myself that can do the following, I am asking for your help.

I need a MS Word 2010 macro that will

  1. search for an endnote (and there are many of them in my document),
  2. copy the entire contents of the endnote,
  3. insert the endnote contents into parentheses and
  4. delete the endnote, as follows:

Before macro is run:

Four score and seven years ago,1 our forefathers ...


1 that is, 87 years ago

After macro is run:

Four score and seven years ago, (that is, 87 years ago) our forefathers ...

Then the macro will continue and search for the next endnote, and do the same until it reaches the end of the document.

I would deeply appreciate your help in this matter.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2013-03-25T04:36:21+00:00

The following commands will do what you are after:

    Dim aendnote As Endnote

    For Each aendnote In ActiveDocument.Endnotes

        With aendnote

            .Reference.InsertBefore "(" & .Range & ")"

            .Reference.Delete

        End With

    Next aendnote

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Paul Edstein 82,861 Reputation points Volunteer Moderator
    2013-03-25T09:55:01+00:00

    Are you sure you're working with endnotes, and not footnotes?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-03-25T09:41:38+00:00

    Mr Robbins, I did everything what you said. I'm sure the problem is staring me in the fact. I'll keep trying.

    Was this answer helpful?

    0 comments No comments
  3. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2013-03-25T08:13:20+00:00

    It works as intended here.

    What did you do with the code?

    See the article "What do I do with macros sent to me by other newsgroup readers to help me out?” at:

    http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-03-25T08:03:46+00:00

    Thank you, Mr. Robbins, but could you take one more look at the code? I tried it but nothing happened. Obviously I am doing something wrong.

    Was this answer helpful?

    0 comments No comments