Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

number of times a workbook has been opened 1

Status
Not open for further replies.

finglem

Technical User
Nov 14, 2003
66
GB
Hi folks

Is it possible to count/record the number of times a workbook has been opened?
 
There is a Revision number property visible in the File...Properties...Statistics menu item. You can retrieve and set the value using VBA code. Here is a Workbook_Open sub for that purpose. It goes in the ThisWorkbook code pane.
Code:
Sub Workbook_Open()
ThisWorkbook.BuiltinDocumentProperties("Revision number") = ThisWorkbook.BuiltinDocumentProperties("Revision number") + 1
MsgBox ThisWorkbook.BuiltinDocumentProperties("Revision number")
End Sub
To paste the sub in the code pane for ThisWorkbook, ALT + F11 to open the VBA Editor then CTRL + R to open the Project Explorer. In the Project Explorer window, doubleclick ThisWorkbook to open its code pane. Paste the code there, then ALT + F11 to return to the spreadsheet.
 
Excellent byundt

Just what I needed!
Thanks

Finglem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top