ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   save as text (https://www.excelbanter.com/excel-programming/306463-re-save-text.html)

Dave Peterson[_3_]

save as text
 
Since you're saving a single sheet, just copy it to a new workbook and save that
workbook. Then close it.

worksheets(".inp").copy
with activesheet.parent
.saveas filename:="d:\temp\temp.inp", FileFormat:=xlText
.close savechanges:=false
end with



Sean wrote:

I have an .xls document with 4 worksheets. I am trying to save the second
tab (from left to right) named ".inp" as a text file named temp.inp

This works fine in Windows 2000 Using the following VBA Code:

'activate the sheet I want to save
Sheets(".inp").Select
'save as text file
ActiveWorkbook.SaveAs Filename:="d:\temp\temp.inp", FileFormat _:=xlText,
CreateBackup:=False

when I run this on Windows XP, it selects he correct sheet (which is the
second of four sheets), but when the file saves, it saves the LAST (the
fourth of four) worksheet as the text file. Is this an error in Excel or XP?
I can move the worksheet I want to save as a text file to the end (make it
the last sheet), but this is only a temp fix

The two systems:
Windows 2000, Excel 200 pro (works fine)
Windows XP, Excell 2000 pro (saves wrong sheet as text file)

any comments or suggestions?
--
Thanks in advance! Sean


--

Dave Peterson



All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com