Consulting

Results 1 to 3 of 3

Thread: macro to run a series of tasks

  1. #1
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    165
    Location

    macro to run a series of tasks

    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

  2. #2
    Site Admin VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,005
    Location
    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:
    [VBA]
    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
    [/VBA]you can work out the additional information and how to save from there!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    165
    Location
    thanks simon fro the feedback, i'll give this a try.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •