View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
des-sa[_2_] des-sa[_2_] is offline
external usenet poster
 
Posts: 74
Default 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