Eu encontrei este que, acredito, resolverá o problema:
Use an Autonew macro to add a sequential number to a document and save it with that number.
In the template from which you create the document, insert a bookmark named Order in the location where you want the sequential number to appear and create an AutoNew macro in the template, as follows:
Sub AutoNew() Order = System.PrivateProfileString("C:\Settings.Txt", _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _ "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") End Sub
If you don't need to display the number in the document, but just want to save it with a sequential number, there is no need to create the bookmark in the template and you should then delete the second last line of the code.