Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel save as csv - force text qualifier on every text field Newbie-Don Excel Discussion (Misc queries) 6 April 2nd 23 08:33 PM
How to save text as CSV which also contains commas? V.R. Excel Discussion (Misc queries) 3 April 10th 06 12:59 PM
save as text question skiier Excel Discussion (Misc queries) 4 August 19th 05 04:35 PM
Export (or save as) .csv with text delimiters CarolineP Excel Discussion (Misc queries) 2 February 17th 05 02:25 AM
Save As - Multiple Sheets fails to save as text file Ravee Srinivasan Excel Programming 2 November 10th 03 04:05 PM


All times are GMT +1. The time now is 04:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"