Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Apr 2003
    Location
    Edinburgh, Midlothian, United Kingdom
    Posts
    93
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Numbers (Word 2000)

    I have created an invoice. What I want it to do is give the invoice a new number every time the template is opened.

    EG the first time its used the number will be 1 - then the next time its used it will number it 2 and so on.

    Is there is Field I can use for this?

  2. #2
    2 Star Lounger
    Join Date
    Nov 2005
    Location
    Monkton, Maryland, USA
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers (Word 2000)

    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.InsertBefo re 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.

    Thanks to Doug Robbins for this information.

  3. #3
    Star Lounger
    Join Date
    Apr 2003
    Location
    Edinburgh, Midlothian, United Kingdom
    Posts
    93
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers (Word 2000)

    Thanks - will give it a go

  4. #4
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers (Word 2000)

    The C-drive is OK if there's only one user for this template. But if there are multiple users, then a better option is to place both the template and the settings file in the WorkgroupTemplates folder. In that case, the code should be changed too:
    - add a line "Dim strFile As String" under the line Sub AutoNew;
    - add a line "strFile = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "Settings.txt" under the previous line;
    - change all occurrences of "C:Settings.txt" in "strFile" (without the quotes this time).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •