Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Open .xls files listed in .txt file and generate report

I am trying to figure out how to write the following code:

I would like to have a dialog box open and the user pick the location
of a .txt file. This .txt file will have the full path of numerous
excel files. I would like the script to

1. open every file listed in the .txt file, until they are all open at
the same time
2. save all the files that were opened
3. close all the files that were opened

Then I would like to generate a .txt file in the following location C:
\Model that lists all the files that were opened and saved during the
run of the procedure and the date and time that they were saved.

I haven't been able to figure this out. Can someone help with a
solution?

Thanks,

Joshua

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Open .xls files listed in .txt file and generate report

On Jun 29, 9:41 pm, cass calculator wrote:
I am trying to figure out how to write the following code:

I would like to have a dialog box open and the user pick the location
of a .txt file. This .txt file will have the full path of numerous
excel files. I would like the script to

1. open every file listed in the .txt file, until they are all open at
the same time
2. save all the files that were opened
3. close all the files that were opened

Then I would like to generate a .txt file in the following location C:
\Model that lists all the files that were opened and saved during the
run of the procedure and the date and time that they were saved.

I haven't been able to figure this out. Can someone help with a
solution?

Thanks,

Joshua


fName = Application.GetOpenFilename( FileFilter:="Text files
(*.txt),*.txt")
If fName < False Then
If Dir(fname) < "" Then 'file exists
Open fname For Input As #1
Do While Not EOF(1)
Line Input #1, workbookpath 'get whole line
Application.Workbooks.Open (workbookpath)
Loop
Close (1)
'Do what you want to do
Open "c:\logfile.txt" For Output As #2
For Each book In Application.Workbooks
book.Save
Print #2, """"; book.Name; """;"; Date; ";"; Time
Next book
Close (2)
End If
End If

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
"Open File" listed in reverse-alphabetical order. Jason[_13_] Excel Discussion (Misc queries) 4 January 8th 09 01:43 PM
how do I use a file list to recall data from listed files? Dave Excel Worksheet Functions 3 January 24th 07 08:27 PM
How to exctract files listed in an Excel-file from a folder? skiern Excel Discussion (Misc queries) 2 May 6th 06 04:41 PM
Generate Report Peter Carlson Excel Worksheet Functions 2 April 12th 06 05:54 AM
file open via IE hyperlink causes already open files to shrink and tile Marc Setting up and Configuration of Excel 0 May 4th 05 08:13 PM


All times are GMT +1. The time now is 11:43 PM.

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"