Share via

Macro to sequentially increase document number when a new document is created

Anonymous
2023-01-30T12:23:41+00:00

Hello, so I am trying to create an Auto-open macro that will automatically type a reference number (e.g. CFO/BOA/F001) and sequentially increase the numerical part of the reference number when a new document is opened. Any ideas?

Microsoft 365 and Office | Word | Other | 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

4 answers

Sort by: Most helpful
  1. Stefan Blom 342.6K Reputation points MVP Volunteer Moderator
    2023-01-30T19:23:22+00:00

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Charles Kenyon 167.8K Reputation points Volunteer Moderator
    2023-01-30T15:46:52+00:00

    This should be an AutoNew macro in your template, not an AutoOpen.

    Suzanne has led you to good sources for code on this. You will probably want to use the second one, either the Add-In or the code reference because the first one tries to write in the root directory and recent versions of Windows require special steps to do that.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Suzanne S Barnhill 278.1K Reputation points MVP Volunteer Moderator
    2023-01-30T12:34:00+00:00

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2023-01-30T19:11:41+00:00

    Hello Suzanne, thanks for the link, but it said page not found. Do you have any other links?

    Was this answer helpful?

    0 comments No comments