Hi members.
I am having major probs trying to save rows as an .XLS file.
I dont know if in the formula below whether it is only placing the text .XLS after the name of the file or actually
saving it in the XLS format.
when i place the file in a program i use, and try to convert it i does not work.
If i place this file back into excel and then save it manually as an XLS it works in my other program.
Is there a way for the formula below (which saves a few thousand files by the first rows text down the column) to save it in the same format as doing it manually,
Sub SaveRows2()
Const MyPath = "C:Testing"
Dim Rng As Range
Dim x As Long
Dim FName As String
Set Rng = Range("A1").CurrentRegion
Application.ScreenUpdating = False
For x = 2 To Rng.Rows.Count Step 2
FName = MyPath & Rng.Cells(x + 1, 1).Text & "D.xls"
'FName = MyPath & Rng.Cells(x, 1).Text
Rng.Cells(x, 1).EntireRow.Resize(2).Copy
Workbooks.Add
ActiveSheet.Paste
ActiveWorkbook.SaveAs Filename:=FName, FileFormat:=xlTextWindows
ActiveWorkbook.Close Savechanges:=False
Next x
Application.ScreenUpdating = True
End Sub
Thanks.
mike.
I am having major probs trying to save rows as an .XLS file.
I dont know if in the formula below whether it is only placing the text .XLS after the name of the file or actually
saving it in the XLS format.
when i place the file in a program i use, and try to convert it i does not work.
If i place this file back into excel and then save it manually as an XLS it works in my other program.
Is there a way for the formula below (which saves a few thousand files by the first rows text down the column) to save it in the same format as doing it manually,
Sub SaveRows2()
Const MyPath = "C:Testing"
Dim Rng As Range
Dim x As Long
Dim FName As String
Set Rng = Range("A1").CurrentRegion
Application.ScreenUpdating = False
For x = 2 To Rng.Rows.Count Step 2
FName = MyPath & Rng.Cells(x + 1, 1).Text & "D.xls"
'FName = MyPath & Rng.Cells(x, 1).Text
Rng.Cells(x, 1).EntireRow.Resize(2).Copy
Workbooks.Add
ActiveSheet.Paste
ActiveWorkbook.SaveAs Filename:=FName, FileFormat:=xlTextWindows
ActiveWorkbook.Close Savechanges:=False
Next x
Application.ScreenUpdating = True
End Sub
Thanks.
mike.