Insert a counter in Word

Solved
LG74 -  
 Lenzini -
Hello everyone,

I have a Word document which is a manufacturing order. I have its number (14/XXX) and I would like the XXX to be a numeric counter that increments automatically with each print.

I have made several attempts with the automatic insertion but without conclusive results.

I also specify that I have very little knowledge of VB programming.

Thank you in advance.

1 answer

  1. Anonymous user
     
    Hello

    You can increment a number with each creation from a template by following this tutorial here
    https://faqword.com/index.php/word-faq/vba-solutions/466

    --
    Argitxu
    2
    1. LG74200 Posted messages 2 Status Member
       
      Thank you for your quick response.

      I tried this tutorial on my document and on a document created for the test.

      For the created document, the macro works but the number does not increment.

      As for my document, the macro stops at the second line (Num = Num + 1) and gives me "type mismatch."

      My document contains mail merge lines; could that be a problem?
      0
    2. Anonymous user
       
      Hello

      So we need to start over from the beginning. This is not related to the mail merge
      Have you properly created the "number" auto-insertion at the start?

      Here is a test template that you can save in your templates for testing
      https://www.cjoint.com/?3CluEhwpRyT

      Argitxu
      0
    3. LG74200 Posted messages 2 Status Member
       
      Thank you, it works.

      In fact, the problem comes from the moment when automatic insertion needs to be done. In the "Gallery" field, I had not changed it to "automatic insertion."

      Thanks again, this saves me a lot of time.
      0
    4. Lenzini
       
      Hello,

      The counter is at the top of the page, but I would like it to be in the middle
      Any ideas?
      0