Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Record Name of Workbook on Close

I am trying to get at a procedure that extends the recent files list for
Excel 2003. Is there a way to record the names of all workbooks onto a
separate Excel file (like maybe Personal.xls) when they are closed? Idealy,
I want to track the name of any workbook I close because the recent files
list only allows a history of up to nine - I have a lot of workbooks that I
open and close and am forgetting where they are on the network.

--
Steph
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Record Name of Workbook on Close

Lets assume that whenever you are working you have a workbook called log.xls
open. Put the following workbook event code in all your other workbooks:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set sl = Workbooks("log.xls").Sheets("logsheet")
s = ThisWorkbook.Name
n = sl.Cells(Rows.Count, 1).End(xlUp).Row + 1
sl.Cells(n, 1) = s
End Sub

Before closing a workbook, its name will be recorded in the log workbook.
--
Gary''s Student - gsnu200780


"Steph" wrote:

I am trying to get at a procedure that extends the recent files list for
Excel 2003. Is there a way to record the names of all workbooks onto a
separate Excel file (like maybe Personal.xls) when they are closed? Idealy,
I want to track the name of any workbook I close because the recent files
list only allows a history of up to nine - I have a lot of workbooks that I
open and close and am forgetting where they are on the network.

--
Steph

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Record Name of Workbook on Close

Hi,

You could put this in module in personal.xls and create a button to run it
in each workbook or call it from the close event

Sub recent()
Dim MyFile As String
Dim MyText As String
Dim FileNum As Integer
MyFile = "c:\recent_files.txt"
MyText = ActiveWorkbook.FullName
FileNum = FreeFile
Open MyFile For Append As FileNum
Write #FileNum, MyText
Close #FileNum
End Sub

the full path name is written to a text file in the root of C but that could
be anywhere.

Mike

"Steph" wrote:

I am trying to get at a procedure that extends the recent files list for
Excel 2003. Is there a way to record the names of all workbooks onto a
separate Excel file (like maybe Personal.xls) when they are closed? Idealy,
I want to track the name of any workbook I close because the recent files
list only allows a history of up to nine - I have a lot of workbooks that I
open and close and am forgetting where they are on the network.

--
Steph

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Record Name of Workbook on Close

Thank you - this helps very much.

--
Steph


"Gary''s Student" wrote:

Lets assume that whenever you are working you have a workbook called log.xls
open. Put the following workbook event code in all your other workbooks:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set sl = Workbooks("log.xls").Sheets("logsheet")
s = ThisWorkbook.Name
n = sl.Cells(Rows.Count, 1).End(xlUp).Row + 1
sl.Cells(n, 1) = s
End Sub

Before closing a workbook, its name will be recorded in the log workbook.
--
Gary''s Student - gsnu200780


"Steph" wrote:

I am trying to get at a procedure that extends the recent files list for
Excel 2003. Is there a way to record the names of all workbooks onto a
separate Excel file (like maybe Personal.xls) when they are closed? Idealy,
I want to track the name of any workbook I close because the recent files
list only allows a history of up to nine - I have a lot of workbooks that I
open and close and am forgetting where they are on the network.

--
Steph

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Record Name of Workbook on Close

Thank you - this helps very much.

--
Steph


"Mike H" wrote:

Hi,

You could put this in module in personal.xls and create a button to run it
in each workbook or call it from the close event

Sub recent()
Dim MyFile As String
Dim MyText As String
Dim FileNum As Integer
MyFile = "c:\recent_files.txt"
MyText = ActiveWorkbook.FullName
FileNum = FreeFile
Open MyFile For Append As FileNum
Write #FileNum, MyText
Close #FileNum
End Sub

the full path name is written to a text file in the root of C but that could
be anywhere.

Mike

"Steph" wrote:

I am trying to get at a procedure that extends the recent files list for
Excel 2003. Is there a way to record the names of all workbooks onto a
separate Excel file (like maybe Personal.xls) when they are closed? Idealy,
I want to track the name of any workbook I close because the recent files
list only allows a history of up to nine - I have a lot of workbooks that I
open and close and am forgetting where they are on the network.

--
Steph

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
Hide all Sheets in Workbook then Close Workbook RyanH Excel Programming 0 January 29th 08 12:59 PM
Open New Workbook / Save and Close Current Workbook Joe K. Excel Programming 1 December 7th 07 08:04 PM
Closing a workbook from a macro doesn't close the workbook Dave P Excel Programming 2 July 10th 07 06:16 PM
Help on Workbook close and workbook save events Adam Harding Excel Programming 1 September 29th 05 04:12 PM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM


All times are GMT +1. The time now is 04:48 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"