Solved

Monitoring Spreadsheet usage

Posted on 2011-02-22
15
191 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now