Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    May 2007
    Location
    Cape Town, Western Cape, South Africa
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Invoice No. (2003)

    Im working on a template that has an invoice number, I want the invoice number to update when i open the template. Please help.

    Regards
    Sharon

  2. #2
    Lounger
    Join Date
    Mar 2001
    Location
    NSW, Australia
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invoice No. (2003)

    Hi Sharon

    Place a bookmark "obmkNumber" at the place the invoice number is to be inserted. Create an AutoNew module in your template with the following code

    Dim iUsageCount As Integer
    Dim sUsageCount As String
    iUsageCount = Val(System.PrivateProfileString("c:IncrementNumber .txt", sFileName, "Number"))
    iUsageCount = iUsageCount + 1
    sUsageCount = CStr(iUsageCount)
    Selection.GoTo What:=wdGoToBookmark, Name:="obmkNumber"
    Selection.TypeText sUsageCount
    System.PrivateProfileString("c:IncrementNumber.txt ", sFileName, "Number") = sUsageCount

    No need to create the txt file as it will be automatic. That's if you want to start numbering from 1 - if you need to change the "start" number, just edit c:IncrementNumber.txt and insert your start number. This template will then have to be run on the same machine to keep the numbering consistent. Hope this helps.

    Cheers
    Lorraine

Posting Permissions

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