What is wr1 format? I have code which can open large numbers of files, manipulate and then save them. The best way is to record a macro of how you converted one file and post the code for that. I'll then change it to allow you to convert all files in a folder automatically.
Regards,
D
Hi DK,
Thank you for your reply. For your information wr1. file is symphony program file (Previous Lotus 123 version).
Mark
Here's code that will open all files in a specified folder and save them as Excel format. Let me know if you have any problems,
D
Option Explicit
Sub ConvertFiles()
'All WR1 files should be in the same folder in order for
'this code to work. There should be no other files other than
'the ones you want to convert.
Dim strFolder As String, lngFile As Long
'Change this to the folder containing the Wr1 files
strFolder = "C:\temp\wr1 files"
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeAllFiles
.LookIn = strFolder
.Execute
For lngFile = 1 To .FoundFiles.Count
'Here's where you need to put the code to open the file and convert it
Workbooks.Open .FoundFiles(lngFile)
ActiveWorkbook.SaveAs "C:\temp\converted files\file" & lngFile, xlExcel7
ActiveWorkbook.Close
Next lngFile
End With
End Sub
Hi Dk,
Thanks for the code. It's work well.
But after converted the wr1 file it have save and rename my file to such as file1, file2, file3... and etc. Whether can we remain back the original name (For e.g. 2001, 2002, 2003, 2004, 2005.....etc.
Thank you.
Mark L
Mark,
This modified code as long as each of your filenames only has one full stop (period) in it. i.e. this won't work very well on a filename such as myfile.2001.wr1. Let me know if it works...
D
Sub ConvertFiles()
'All WR1 files should be in the same folder in order for
'this code to work. There should be no other files other than
'the ones you want to convert.
Dim strFolder As String, lngFile As Long, strNewName As String
Dim FSObj As Object, FSFile As Object
Set FSObj = CreateObject("Scripting.FilesystemObject")
'Change this to the folder containing the Wr1 files
strFolder = "C:\temp\wr1 files"
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeAllFiles
.LookIn = strFolder
.Execute
For lngFile = 1 To .FoundFiles.Count
'Here's where you need to put the code to open the file and convert it
Workbooks.Open .FoundFiles(lngFile)
Set FSFile = FSObj.GetFile(.FoundFiles(lngFile))
strNewName = Left(FSFile.Name, InStr(1, FSFile.Name, ".") - 1)
ActiveWorkbook.SaveAs "C:\temp\converted files\" & strNewName, xlExcel7
ActiveWorkbook.Close
Next lngFile
End With
End Sub