+ Reply to Thread
Results 1 to 5 of 5

Creating an access log

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-14-2005
    Posts
    164

    Creating an access log

    Is it at all possible to create a text file, so that when any user opens a particular spreadsheet, their username and current system date is appended to the text file?

    I'm inerested in creating an access log for one of our spreadsheets.
    I'm no VBA expert, but i'm assuming this might quite straight forward.
    Havent got a clue how to get the user's login ID, or Excel User name, so any help will be appreciated.

    thanks in advance,
    Matt

  2. #2
    K Dales
    Guest

    RE: Creating an access log

    Yes, I answered the same question a while back but cannot remember the link;
    search this group for access log
    --
    - K Dales


    "matpj" wrote:

    >
    > Is it at all possible to create a text file, so that when any user opens
    > a particular spreadsheet, their username and current system date is
    > appended to the text file?
    >
    > I'm inerested in creating an access log for one of our spreadsheets.
    > I'm no VBA expert, but i'm assuming this might quite straight forward.
    > Havent got a clue how to get the user's login ID, or Excel User name,
    > so any help will be appreciated.
    >
    > thanks in advance,
    > Matt
    >
    >
    > --
    > matpj
    > ------------------------------------------------------------------------
    > matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076
    > View this thread: http://www.excelforum.com/showthread...hreadid=528071
    >
    >


  3. #3
    Forum Contributor
    Join Date
    03-14-2005
    Posts
    164
    hi,

    thanks for the response.
    I couldn't find a post with a reply frmo you, but I found another one that does exactly what I want, although the spreadsheet I am creating will be saved in a Notes database.

    I need the log file to be in a specified network path although when I try to use that, it throws up an error.

    the original code for the log is:

    Sub DoTheLog(myKey As String)
    Open ThisWorkbook.Path & "\" & Left(ActiveWorkbook.Name, _
    Len(ActiveWorkbook.Name) - 4) & "_usage.log" For Append As #1
    Print #1, myKey & vbTab & Application.UserName _
    & vbTab & fOSUserName _
    & vbTab & fOSMachineName _
    & vbTab & Format(Now, "mmmm dd, yyyy hh:mm:ss")
    Close #1
    End Sub
    i'm trying to change the Open bit to read:

    Open "\\Cs_fs1\Prodvol\Techserv\" & Left(ActiveWorkbook.Name, _
    Len(ActiveWorkbook.Name) - 4) & "_usage.log" For Append As #1
    but when I do this it displays an error saying cannot find path.
    That is a valid path and it is currently mapped to my PC.

  4. #4
    NickHK
    Guest

    Re: Creating an access log

    matpj,
    What does the "Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)"
    part evaluate to ?

    NickHK

    "matpj" <matpj.25hokp_1143733203.3108@excelforum-nospam.com> wrote in
    message news:matpj.25hokp_1143733203.3108@excelforum-nospam.com...
    >
    > hi,
    >
    > thanks for the response.
    > I couldn't find a post with a reply frmo you, but I found another one
    > that does exactly what I want, although the spreadsheet I am creating
    > will be saved in a Notes database.
    >
    > I need the log file to be in a specified network path although when I
    > try to use that, it throws up an error.
    >
    > the original code for the log is:
    >
    >
    > Code:
    > --------------------
    > Sub DoTheLog(myKey As String)
    > Open ThisWorkbook.Path & "\" & Left(ActiveWorkbook.Name, _
    > Len(ActiveWorkbook.Name) - 4) & "_usage.log" For Append As #1
    > Print #1, myKey & vbTab & Application.UserName _
    > & vbTab & fOSUserName _
    > & vbTab & fOSMachineName _
    > & vbTab & Format(Now, "mmmm dd, yyyy hh:mm:ss")
    > Close #1
    > End Sub
    > --------------------
    >
    >
    > i'm trying to change the Open bit to read:
    >
    >
    > Code:
    > --------------------
    > Open "\\Cs_fs1\Prodvol\Techserv\" & Left(ActiveWorkbook.Name, _
    > Len(ActiveWorkbook.Name) - 4) & "_usage.log" For Append As #1
    >
    > --------------------
    >
    >
    > but when I do this it displays an error saying cannot find path.
    > That is a valid path and it is currently mapped to my PC.
    >
    >
    > --
    > matpj
    > ------------------------------------------------------------------------
    > matpj's Profile:

    http://www.excelforum.com/member.php...o&userid=21076
    > View this thread: http://www.excelforum.com/showthread...hreadid=528071
    >




  5. #5
    Forum Contributor
    Join Date
    03-14-2005
    Posts
    164
    that makes sure that the ".xls" is removed from the file name when giving a name to the log file!

+ 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