Visual Basic and Sequential numbers

New Contributor

Hello

I have created Visual Basic code to create an auto number, when I run the Visual basic code, but I am trying to figure out how to run it automatically so that each time the document opens it will create a new unique number.

4 Replies

Hi David,

 

Press Alt+F11 to open the VBA editor, then select ThisDocument code module, and copy your code inside Document_Open() event as shown in the below screenshot.

 

Document_Open.png

 

Hope that helps

Perfect. Thank you

David,

 

Would it be possible to borrow the code you created to do this? I am looking for a way that every time my excel template is opened and saved it is given a unique but sequential number from the previous time. Similar to a quoting system or a transaction ID