LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Count numbers of times workbook opened

Normally I try not to shoot down a suggestion (just because it is different
from how I would go about it does not make it wrong... just different) but in
this case the code posted will cause problems.

The code posted is intended to be placed in ThisWorkbook. But the reference
is to A65500 which will be a problem as it will refer to cell 65,500 on
whichever sheet might happen to be active at the time the book is opened.
Next time it is opened it could be a different sheet. Also the cell is not
hidden from the end user who could delete it (intentioanlly or otherwise).
Also if a row is deleted or inserted on the sheet the value will be moved and
now the value will be lost. here is how I would go about it...

Create a new sheet called Variables (or whatever makes your heart go pitter
patter). The only thing this sheet will be used for is holding values that
the end user will never see.

In Cell A1 on the sheet add Workbook Opened (we will put the number of times
in Cell B1)

Private Sub Workbook_Open()
with sheets("Variables").range("B1")
.Value = .Value +1
msgbox "This book has been opened " & .Value & " times."
end with
sheets("Variables").visible = xlVeryHidden
End Sub

--
HTH...

Jim Thomlinson


"excelent" wrote:

my best ges:

Private Sub Workbook_Open()
MsgBox ("This file has been opened ") & [a65500] & " times"
[a65500] = [a65500] + 1
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting Number of Times a Workbook can be Opened Dan R Excel Worksheet Functions 1 February 13th 07 03:28 PM
I need to be able to count the no. of times a sprdsheet is opened Melvin P Excel Discussion (Misc queries) 2 January 22nd 07 11:16 AM
times of opened jinvictor[_2_] Excel Programming 2 June 18th 06 08:21 PM
How do I count how many times an Excel workbook has been accessed damcp Excel Discussion (Misc queries) 1 June 16th 06 01:01 AM
Opening a workbook if not opened, going to it if already opened neotokyo[_2_] Excel Programming 1 September 24th 04 07:17 PM


All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"