Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 wrote in message oups.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
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to log all excel files opened on my pc?
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 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 -- pianoman ------------------------------------------------------------------------ pianoman's Profile: http://www.excelforum.com/member.php...o&userid=33712 View this thread: http://www.excelforum.com/showthread...hreadid=549373 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to log all excel files opened on my pc?
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 " 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple files opened when Excel started | Excel Discussion (Misc queries) | |||
my excel files are being opened in Word and are unreadable Why? | New Users to Excel | |||
can't close files opened in an excel application?? | Excel Programming | |||
Excel not showing last opened files | Excel Discussion (Misc queries) | |||
can cvs files be opened using excel viewer | Excel Discussion (Misc queries) |