Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default 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




  #6   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


Reply
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:33 AM.

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

About Us

"It's about Microsoft Excel"