LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
M H M H is offline
external usenet poster
 
Posts: 28
Default automated file loading and saving

Hi,
I have a folder containing hundreds of tab-delimited text files, and
need to convert all of them into Excel files. Presumably I should
automate the conversion in the following steps:
1. Use Application.FileDialog(msoFileDialogFilePicker) or .FileSearch to
point to the folder containing the files (I want it to be manual);
2. Excel loads individual files, one by one, with bypassing the wizard,
to become a worksheet of data;
3. Excel saves the data with the same name (but certainly will be .xls
not .txt) to the same directory of the source files.
4. Repeat the action until all files are done, show up a prompt msgbox
with time spent.

From Wrox Excel 2003 VBA book, I've got something like following after
modifications:

Public Sub FindDataFiles()
Dim FileName As Variant
Dim Message As String
Dim Count As Long

With Application.FileSearch
' Prepare search criteria
.NewSearch
.LookIn = "c:\data"
.SearchSubFolders = True
'.squ is the extension of my data files
.FileType = "*.squ"
.LastModified = msoLastModifiedAnyTime
Count = .Execute

' Prepare output text
Message = Format(Count, "0 ""Files Processed""")

' Here I need some codes to do what
' abovementioned and a timer.
' The Message has also to be modified
' to show the time
Call MsgBox(Message, vbInformation)
End With
End Sub

Much much thanks if someone could help for this.

rgds,
Maurice

*** Sent via Developersdex http://www.developersdex.com ***
 
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
Excel 2007 - error saving file & error loading dll TinaF Excel Discussion (Misc queries) 0 July 1st 09 01:49 PM
Excel 2007 one network file running (loading and saving) slow Polly Welch Excel Discussion (Misc queries) 0 July 20th 07 11:44 PM
Automated Saving of File SU Excel Programming 6 November 21st 05 08:12 PM
Automated saving - Please Help & Advice SU Excel Programming 2 March 1st 05 12:28 PM
Excessive time loading/saving file Emile Zac Excel Programming 2 September 18th 04 10:46 PM


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