PDA

View Full Version : macro to run a series of tasks



keilah
03-30-2008, 03:32 AM
Hi Experts

I have no idea how to do the following -

Need a macro that monitors who has logged into any particular workbook and amended any worksheet in that workbook. All the work books will be located in the folder in a common shared drive.

The macro need to record and enter the following information in a stand alone workbook/worksheet under the following heading:

User ID or Computer Name | WorkBook/Sheet Opened | Date | Time Opened | Time Closed | etc.....

Need to monitor the activities of the end users. If there is a much better or efficient way to do this all ideas welcome.

thanks

Simon Lloyd
03-30-2008, 03:53 AM
You would need to install an add in or in each workbook workbook_close event add some code to open the destination workbook and add the data something like:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Workbooks.Open ("C:\Test\Log sheet.xls")
ActiveWorkbook.Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Offset(1, 0).Value = Time
ActiveWorkbook.Close (True)
End Sub
Private Sub Workbook_Open()
Dim Rng As Range
Workbooks.Open ("C:\Test\Log sheet.xls")
Set Rng = ActiveWorkbook.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp)
With Rng.Offset(1, 0)
.Value = Environ("username")
.Offset(0, 1).Value = Date
.Offset(0, 2).Value = Time
End With
ActiveWorkbook.Close (True)
End Sub
you can work out the additional information and how to save from there!

keilah
03-30-2008, 03:59 AM
thanks simon fro the feedback, i'll give this a try.