+ Reply to Thread
Results 1 to 6 of 6

how to log all excel files opened on my pc?

Hybrid View

  1. #1
    jgalt650-excel@yahoo.com
    Guest

    how to log all excel files opened on my pc?

    I'm looking for a program or process by which all excel files will be
    written to a text log file or a personal.xls worksheet on my pc.

    A log entry would be created each time I open a file.

    The log entry would list the name of the file, the path, the date, and
    time, and the file type.

    Any ideas would be much appreciated.

    Thanks,

    JGalt


  2. #2
    Registered User
    Join Date
    04-21-2006
    Posts
    61
    Sorry, I can't give you the exact code, but I'm not an expert myself!

    I think what you're looking for is an Auto_open routine stored in the personal.xls file, which you hide and then save as the template for all excel documents on your pc. Then you write code into the Auto_open sub which which collect all that info and write to a log file. This will then open and run any time an excel file is opened.

    Getting all the info is pretty straight forward, and opening a file and adding the entries to an existing list is easy... hope this helps. Let me know if you need code for those bits.

    Regards,
    Gareth

    Quote Originally Posted by jgalt650-excel@yahoo.com
    I'm looking for a program or process by which all excel files will be
    written to a text log file or a personal.xls worksheet on my pc.

    A log entry would be created each time I open a file.

    The log entry would list the name of the file, the path, the date, and
    time, and the file type.

    Any ideas would be much appreciated.

    Thanks,

    JGalt

  3. #3
    NickHK
    Guest

    Re: how to log all excel files opened on my pc?

    A place to start would Application level events:
    http://www.cpearson.com/excel/AppEvent.htm

    Then each time a WB is opened, log the .Name/.Path to somewhere suitable.

    NickHk

    <jgalt650-excel@yahoo.com> wrote in message
    news:1149669593.712110.278750@h76g2000cwa.googlegroups.com...
    > I'm looking for a program or process by which all excel files will be
    > written to a text log file or a personal.xls worksheet on my pc.
    >
    > A log entry would be created each time I open a file.
    >
    > The log entry would list the name of the file, the path, the date, and
    > time, and the file type.
    >
    > Any ideas would be much appreciated.
    >
    > Thanks,
    >
    > JGalt
    >




  4. #4
    Ardus Petus
    Guest

    Re: how to log all excel files opened on my pc?

    Here is an example of what you need: http://cjoint.com/?ghl6Ew682v

    HTH
    --
    AP

    <jgalt650-excel@yahoo.com> a écrit dans le message de news:
    1149669593.712110.278750@h76g2000cwa.googlegroups.com...
    > I'm looking for a program or process by which all excel files will be
    > written to a text log file or a personal.xls worksheet on my pc.
    >
    > A log entry would be created each time I open a file.
    >
    > The log entry would list the name of the file, the path, the date, and
    > time, and the file type.
    >
    > Any ideas would be much appreciated.
    >
    > Thanks,
    >
    > JGalt
    >




  5. #5
    jgalt650-excel@yahoo.com
    Guest

    Re: how to log all excel files opened on my pc?

    Ardus - This is fantastic. Just what I was looking for. Thank you so
    much. One followup question, I tried to modify your code to to create
    log entries for close events and save events, but was unable to
    understand how the code is called.


    Under CAppEvents I modified it to:
    Option Explicit

    Public WithEvents oApp As Application


    Private Sub Class_Initialize()
    Set oApp =3D Application
    End Sub

    Private Sub oApp_WorkbookOpen(ByVal Wb As Workbook)
    Dim rCell As Range
    With ThisWorkbook.Worksheets("Log").Cells(Rows.Count,
    "A").End(xlUp).Offset(1, 0)
    .Value =3D Now
    .Offset(0, 1) =3D Wb.Path
    .Offset(0, 2) =3D Wb.Name
    .Offset(0, 3) =3D "open"
    End With
    End Sub


    Private Sub oApp_WorkbookClose(ByVal Wb As Workbook)
    Dim rCell As Range
    With ThisWorkbook.Worksheets("Log").Cells(Rows.Count,
    "A").End(xlUp).Offset(1, 0)
    .Value =3D Now
    .Offset(0, 1) =3D Wb.Path
    .Offset(0, 2) =3D Wb.Name
    .Offset(0, 3) =3D "close"
    End With
    End Sub


    Private Sub oApp_WorkbookSave(ByVal Wb As Workbook)
    Dim rCell As Range
    With ThisWorkbook.Worksheets("Log").Cells(Rows.Count,
    "A").End(xlUp).Offset(1, 0)
    .Value =3D Now
    .Offset(0, 1) =3D Wb.Path
    .Offset(0, 2) =3D Wb.Name
    .Offset(0, 3) =3D "Save"
    End With
    End Sub

    and under This Workbook I modified to:
    Option Explicit
    Dim oAppEvents As CAppEvents

    Private Sub Workbook_Open()
    Set oAppEvents =3D New CAppEvents
    End Sub
    Private Sub Workbook_Close()
    Set oAppEvents =3D New CAppEvents
    End Sub
    Private Sub Workbook_Save()
    Set oAppEvents =3D New CAppEvents
    End Sub


    Any idea what tweak would be needed to also log saves and closes?

    Thank you.
    This is so fantastic.


    Jgalt



    Ardus Petus wrote:
    > Here is an example of what you need: http://cjoint.com/?ghl6Ew682v
    >
    > HTH
    > --
    > AP
    >
    > <jgalt650-excel@yahoo.com> a =E9crit dans le message de news:
    > 1149669593.712110.278750@h76g2000cwa.googlegroups.com...
    > > I'm looking for a program or process by which all excel files will be
    > > written to a text log file or a personal.xls worksheet on my pc.
    > >
    > > A log entry would be created each time I open a file.
    > >
    > > The log entry would list the name of the file, the path, the date, and
    > > time, and the file type.
    > >
    > > Any ideas would be much appreciated.
    > >
    > > Thanks,
    > >
    > > JGalt
    > >



  6. #6
    Bob
    Guest

    RE: how to log all excel files opened on my pc?

    Hi

    Try this.

    Sub Auto_Open
    Open "C:\usage.log" For Append As #1
    Print #1, Thisworkbook.Name, Thisworkbook.Path, Now
    Close #1
    End Sub

    Bob

    "jgalt650-excel@yahoo.com" wrote:

    > I'm looking for a program or process by which all excel files will be
    > written to a text log file or a personal.xls worksheet on my pc.
    >
    > A log entry would be created each time I open a file.
    >
    > The log entry would list the name of the file, the path, the date, and
    > time, and the file type.
    >
    > Any ideas would be much appreciated.
    >
    > Thanks,
    >
    > JGalt
    >
    >


+ 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