how do i save as a correct XLS

excelent

Board Regular
Joined
Sep 7, 2002
Messages
105
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.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

excelent

Board Regular
Joined
Sep 7, 2002
Messages
105
I solved it by searching a few posts.

I had to add the line

FileFormat:=xlWorkbookNormal


cheers.

mike.
 

Gates Is Antichrist

Well-known Member
Joined
Aug 15, 2002
Messages
1,961
I solved it by searching a few posts.
excelent, thanks for taking the effort to share your solution. Few seem to bother to do that if their question isn't solved by another; but your answer could valuably save someone sometime when they're searching for a solution to the same problem.
 

Forum statistics

Threads
1,144,311
Messages
5,723,645
Members
422,508
Latest member
Lordkit1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top