Suneel,
You could create a workbook name and increment that when opening the file,
and append it as a version number like so
Dim sFile As String
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With ActiveWorkbook
sFile = Left(.Name, Len(.Name) - 4) 'remove .xls
sFile = Left(sFile, InStrRev(sFile, "V")) &
Evaluate(Names("version").RefersTo)
.SaveAs Filename:=sFile
End With
End Sub
Private Sub Workbook_Open()
ActiveWorkbook.Names.Add Name:="version", _
RefersTo:=Evaluate(Names("version").RefersTo) + 1
End Sub
And here is a function to get created and modified dates.
Function DocProperty(DocType As String)
With ActiveWorkbook
Select Case LCase(DocType)
Case "created": DocProperty =
Format(.BuiltinDocumentProperties("Creation Date"), "dd mmm yyyy")
Case "modified": DocProperty =
Format(.BuiltinDocumentProperties("Last Save Time"), "dd mmm yyyy")
Case Else: DocProperty = CVErr(xlErrValue)
End Select
End With
End Function
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)