View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_318_] Leith Ross[_318_] is offline
external usenet poster
 
Posts: 1
Default Counter in Excel template


Hello office newbie,

This counter will increment every time the template is opened. You ca
also use these same calls elsewhere in the code to increment the counte
if you need to. You can change the names template, opened, and counte
to whatever you like. The counter is stored in the Registry of th
machine it resides on. This insures the count will be accurate, even i
the program crashes.


Code
-------------------
Private Sub Workbook_Open()

Dim Cnt As Long

Cnt = Val(GetSetting("template", "opened", "counter"))
Cnt = Cnt + 1
SaveSetting "template", "opened", "counter", Str(Cnt)

End Sub

-------------------

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=48751