![]() |
code for auto numbering documents
hi,
can someone please help. i have the following code for saving the same template with cosecutive document numbers on our network. a drive "Z" was created where every document is saved, but what happens is that 4 computers are used for quoting by different people and it seems as if every computer generates its own range of numbers, starting at one off course. so it now happens that the are 2 quotes with number 40177. is there a way of correcting this? the code is: Sub SvMe() Dim newFile As String, fName As String fName = Range("K2") & "=" & Range("G11") & "," & Range("G12") & "=" & Range("G9") & "=" & Range("B8") & "," & Range("B9").Value newFile = fName & " " & Format$(Date, "dd-mm-yy") ' Change directory to suit your PC, including USER NAME Dim Filename As Variant ChDrive "Z" ChDir "Z:\" ActiveWorkbook.SaveAs Filename:=newFile If TypeName(Filename) < "Boolean" Then MsgBox Filename End If End Sub |
code for auto numbering documents
Maybe using a text file to keep track of the numbers would be ok:
http://www.mcgimpsey.com/excel/udfs/sequentialnums.html Look for: "Using a text file to hold sequential numbers" des-sa wrote: hi, can someone please help. i have the following code for saving the same template with cosecutive document numbers on our network. a drive "Z" was created where every document is saved, but what happens is that 4 computers are used for quoting by different people and it seems as if every computer generates its own range of numbers, starting at one off course. so it now happens that the are 2 quotes with number 40177. is there a way of correcting this? the code is: Sub SvMe() Dim newFile As String, fName As String fName = Range("K2") & "=" & Range("G11") & "," & Range("G12") & "=" & Range("G9") & "=" & Range("B8") & "," & Range("B9").Value newFile = fName & " " & Format$(Date, "dd-mm-yy") ' Change directory to suit your PC, including USER NAME Dim Filename As Variant ChDrive "Z" ChDir "Z:\" ActiveWorkbook.SaveAs Filename:=newFile If TypeName(Filename) < "Boolean" Then MsgBox Filename End If End Sub -- Dave Peterson |
All times are GMT +1. The time now is 08:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com