Solved

Monitoring Spreadsheet usage

Posted on 2011-02-22
15
193 Views
Last Modified: 2012-08-13
is it possible to record how long a user stayed in a spreadsheet regardless of whether they save it. So if the user clicks leaves the spreadsheet it records the time/date

Thanks
Seamus
0
Comment
Question by:Seamus2626
  • 7
  • 5
  • 3
15 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 34951892
So if the workbook is closed irrespective of whether it was saved?
0
 

Author Comment

by:Seamus2626
ID: 34951906
Exactly

Thanks
Seamus
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34951921
Seamus - what about this in the ThisWorkbook module? Suppose if you wanted it displayed elsewhere would need to rethink.
Dim t As Double

Private Sub Workbook_Open()

t = Now()

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)

MsgBox Now() - t

End Sub

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Seamus2626
ID: 34951950
Could that work with the below i wonder? I have this code but it relys on user saving ss which isnt practical in this particular report

Can you apply the above to the below?

Thanks
Seamus
Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheets("check")
    .Range("B64000").End(xlUp).Offset(0, 2) = Now()
End With
ActiveWorkbook.Save
End Sub

Private Sub Workbook_Open()
With Sheets("check")
   .Range("B64000").End(xlUp).Offset(1, 0) = Environ("USERNAME")
   .Range("B64000").End(xlUp).Offset(0, 1) = Now()
End With
End Sub

Open in new window

0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34951986
Like this?
Dim t As Double

Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheets("check")
    .Range("B64000").End(xlUp).Offset(0, 2) = Format(Now() - t, "h:mm:ss")
End With
ActiveWorkbook.Save
End Sub

Private Sub Workbook_Open()

t = Now()
With Sheets("check")
   .Range("B64000").End(xlUp).Offset(1, 0) = Environ("USERNAME")
   .Range("B64000").End(xlUp).Offset(0, 1) = Now()
End With
End Sub

Open in new window

0
 

Author Comment

by:Seamus2626
ID: 34952069
Thats good Stephen, its recording the time i spent in there, the only problem is the file is saving on exit, so no one gets a prompt to save. Dangerous errors could be saved, can the prompt to save be retained while keeping the functionality to record the time spent in the ss?

Thanks
Seamus
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34952094
What about commenting out line 7?
0
 
LVL 17

Expert Comment

by:gtgloner
ID: 34952243
Have a look at this file:
Book1.xls
0
 

Author Comment

by:Seamus2626
ID: 34952333
That didnt work without the save Stephen


gtgloner: that is what im looking for, but its not creating a list, i need it to keep building that data, so the next time it returns to  d2, then d3, so i can build a history of who was in the ss and for how long.

Thanks
Seamus
0
 
LVL 24

Accepted Solution

by:
StephenJR earned 250 total points
ID: 34952397
Seamus - how so? If a change is made you'll be prompted to save, no?
0
 
LVL 17

Assisted Solution

by:gtgloner
gtgloner earned 250 total points
ID: 34952446
OK, I think I have it now:
Book1.xls
0
 

Assisted Solution

by:Seamus2626
Seamus2626 earned 0 total points
ID: 34952499
Problem is guys, if the user doesnt save on either approach, the data wont be saved on reopening that file......
0
 
LVL 17

Expert Comment

by:gtgloner
ID: 34978627
Sounds fine to me.
0
 

Author Comment

by:Seamus2626
ID: 34978638
Not sure why this question hasnt closed with the points assigned......
0
 

Author Closing Comment

by:Seamus2626
ID: 34990787
thanks guys, i will be able to work the last part out

Cheers
Seamus
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question