+ Reply to Thread
Results 1 to 6 of 6

Worksheet Access Log

Hybrid View

narrowgate88 Worksheet Access Log 08-26-2009, 09:37 AM
hutch@edge.net Re: Worksheet Access Log 08-26-2009, 09:57 AM
narrowgate88 Re: Worksheet Access Log 08-26-2009, 10:20 AM
hutch@edge.net Re: Worksheet Access Log 08-26-2009, 10:42 AM
hutch@edge.net Re: Worksheet Access Log 08-26-2009, 10:48 AM
narrowgate88 Re: Worksheet Access Log 08-26-2009, 11:46 AM
  1. #1
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Lincoln, IL
    MS-Off Ver
    365
    Posts
    242

    Question Worksheet Access Log

    I want to create a log of everyone who opens a particular workbook. I'm using Excel 2003. I found this macro, and created a worksheet called "Log", but I've opened the workbook several times and nothing appears on the Log sheet. What am I missing?

    Private Sub Workbook_Open()
    Worksheets("Log").Range("A65536").End(xlUp).Offset(1, 0).Value _
        = Format(Now(), "mm-dd-yy HH MM AMPM")
    Worksheets("Log").Range("B65536").End(xlUp).Offset(1, 0).Value _
        = Environ("UserName")
    End Sub
    Last edited by narrowgate88; 08-26-2009 at 11:46 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Re: Worksheet Access Log

    I tested it in a workbook and it worked fine. Be sure you have th code in the "This Workbook" module, as in the attached test.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Lincoln, IL
    MS-Off Ver
    365
    Posts
    242

    Re: Worksheet Access Log

    I didn't have it in "This Workbook" so now it works. Now, because I've added this, it now asks the user if they want to save changes. Can I get it to bypass this if the only change that was made was updating the log?

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Re: Worksheet Access Log

    You'll probably need a real guru to answer that one. I'm just a newbie.

    It seems to me you could add code at the bottom of the workbook open macro that would automatically save the changes after the log file was writtent to, so it wouldn't ask if there were no other changes made. That would cause a prompt to show asking where to save the workbook, however, if the workbook doesn't exist on their computer.

    I tried adding "SaveChanges = True" to the end of the code. That didn't do it.

  5. #5
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Re: Worksheet Access Log

    Try this:

    Private Sub Workbook_Open()
    Dim sPath As String, sFname As String
    Worksheets("Log").Range("A65536").End(xlUp).Offset(1, 0).Value _
        = Format(Now(), "mm-dd-yy HH MM AMPM")
    Worksheets("Log").Range("B65536").End(xlUp).Offset(1, 0).Value _
        = Environ("UserName")
    Application.DisplayAlerts = False
        sFname = ActiveWorkbook.Name
        sPath = ActiveWorkbook.Path
        ActiveWorkbook.SaveAs (sPath & "\" & sFname), _
                FileFormat:=xlNormal
    Application.DisplayAlerts = True
    End Sub

  6. #6
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Lincoln, IL
    MS-Off Ver
    365
    Posts
    242

    Re: Worksheet Access Log

    Yes, that worked! Not bad for a newbie. Thanks so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1