LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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 = 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 = Now
.Offset(0, 1) = Wb.Path
.Offset(0, 2) = Wb.Name
.Offset(0, 3) = "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 = Now
.Offset(0, 1) = Wb.Path
.Offset(0, 2) = Wb.Name
.Offset(0, 3) = "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 = Now
.Offset(0, 1) = Wb.Path
.Offset(0, 2) = Wb.Name
.Offset(0, 3) = "Save"
End With
End Sub

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

Private Sub Workbook_Open()
Set oAppEvents = New CAppEvents
End Sub
Private Sub Workbook_Close()
Set oAppEvents = New CAppEvents
End Sub
Private Sub Workbook_Save()
Set oAppEvents = 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

a écrit dans le message de news:
...
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




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple files opened when Excel started Teri H Excel Discussion (Misc queries) 2 May 28th 08 06:20 PM
my excel files are being opened in Word and are unreadable Why? willy New Users to Excel 2 August 5th 06 05:49 PM
can't close files opened in an excel application?? urgent Excel Programming 3 September 29th 05 01:33 AM
Excel not showing last opened files Luis Verme Excel Discussion (Misc queries) 0 August 19th 05 04:20 PM
can cvs files be opened using excel viewer darriel Excel Discussion (Misc queries) 1 May 31st 05 04:15 PM


All times are GMT +1. The time now is 12:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"