Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I hope somebody can help me
I am trying to create a template that will allow me to record a unique Record ID for each form generated from the template. (Kind of like an invoice number Any Ideas Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sean
The way that I do this is store the last invoice number used in a text file. Then when I want a new invoice number, my code retrieves the number, increments it by one and writes the new number back to the text file. If more than one person uses the template, you could have a problem where they both get the old number before the new one is written. I'm the only one that uses mine, so I haven't looked into how to prevent that. Here's the code that I use: Sub NextInv() Dim FName As String Dim FNum As Long Dim LstInv As String FName = "\\Server1\c\Paragon\Policies & Forms\LastInv.txt" FNum = FreeFile Open FName For Input As FNum Input #FNum, LstInv Close FNum Range("B18").Value = CLng(LstInv) + 1 Open FName For Output As FNum Print #FNum, CLng(LstInv) + 1 Close FNum Sheet1.Shapes("Button 1").Visible = False Range("g10").Select End Sub -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "Sean Reilly" wrote in message ... Hi, I hope somebody can help me. I am trying to create a template that will allow me to record a unique Record ID for each form generated from the template. (Kind of like an invoice number) Any Ideas? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Template problem - update existing record | Excel Discussion (Misc queries) | |||
Using Student Attendance Record template in Excel 2003 | Excel Worksheet Functions | |||
Template for Excel to keep running record? | Excel Discussion (Misc queries) | |||
How do I assign sequential numbers in an Excel 2003 PO template? | Excel Worksheet Functions | |||
How do I save a record from an excel template to a database in a . | Excel Discussion (Misc queries) |