Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jason
Try this Sub OpenAllTxt() Dim FName As String Dim sPath As String Dim wb As Workbook sPath = "C:\Dick\Tester\" FName = Dir("C:\Dick\Tester\*.txt") Do While Len(FName) 0 Workbooks.OpenText sPath & FName, xlWindows, _ 1, xlDelimited, , True, , , , , Array(1, 1) Set wb = ActiveWorkbook wb.SaveAs UCase(Left(sPath & FName, _ Len(sPath & FName) - 4)) & ".xls", xlWorkbookNormal wb.Close False FName = Dir Loop End Sub You'll need to change the path and OpenText arguments to suit your situation. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "Jason" wrote in message ... Hello folks, I am wondering if anyone could help with the following task. I have a folder that contains 50 txt files. I want to create a macro that opens all 50, and then saves them with the same file name it currently has and capitalizes it (i.e. save abc.txt as ABC.xls). Ideally, it should be smart enough to finish when all the txt files are saved as excel. I am not sure if this is possible, but I thought I would throw it out there anyway. Thanks, Jason |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pulling pdf files from general folder to specific folder | Excel Discussion (Misc queries) | |||
Problem saving and opening Excel files in C drive. | Excel Discussion (Misc queries) | |||
Default folder for opening/saving files | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
saving *.xls files but troubles with opening with MS Excel | Excel Programming |