View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Marco[_6_] Marco[_6_] is offline
external usenet poster
 
Posts: 3
Default How to create an automatic counter

Hi

What you can do is add the following to your code

Sub AutoNew(

Order = System.PrivateProfileString("C:\Settings.Txt", "Macrosettings", "Order"
If Order = "" The
Order =
Els
Order = Order +
End I

System.PrivateProfileString("C:\Settings.Txt", "Macrosettings", "Order") = Orde
ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "00#"
End Su

The first time te file settings.txt will be created. And every time you create a new file, the value = value + 1. Place the field in your document and you have your counter..

Good luck
Marco.