Book

Suggestions


Enter your email address:

Delivered by FeedBurner


Home Page

Bloglines

1906
CelebrateStadium
2006


OfficeZealot

Scobleizer

TechRepublic

AskWoody

SpyJournal












Subscribe here
Add to 

My Yahoo!
This page is powered by Blogger. Isn't yours?

Host your Web site with PureHost!


eXTReMe Tracker
  Web http://www.klippert.com



  Sunday, July 13, 2008 – Permalink –

AutoNumber Invoices

Creating sequentially numbered documents


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, 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 do not 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.

Article contributed by Doug Robbins
Word MVP Site


Microsoft Knowledgebase:
Macro to Increment Invoice Number to New Form Document


WordTips:
Sequentially numbered Labels


Here's a further discussion including methods to create sequential ticket numbers:

Here's the PDF version:
Word Field Codes Revealed



See all Topics

Labels: , , ,


<Doug Klippert@ 2:09 AM

Comments: Post a Comment