LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to export a range of cells on a worksheet to a text file

I would try either of these and see what you get

xlTextMSDOS

xlTextPrinter



--

Regards,

Tom Ogilvy



wrote in message
oups.com...
Thanks, Tom. That's just what I needed. (BTW, the text type will be MS-
DOS text, which is what I think Microsoft notepad uses, correct?)

Thanks much to NickHK for his input in the next post, too. It is
appreciated.

Best Regards,
Joseph


On Feb 13, 8:19 pm, "Tom Ogilvy" wrote:
Sub CreateFile()
Dim sh asWorksheet, sh1 asWorksheet
set sh = Activesheet
workbooks.Add Template:=xlWBATWorksheet
set sh1 = Activesheet
sh.Range("A1:F20").Copy
sh1.Range("A1").PasteSpecial xlValues
Application.DisplayAlerts = False
sh1.parent.SaveAs "C:\Myfolder\Myfile.txt", xlCSV '<== Change
Application.DisplayAlerts = True
End Sub

there are many different formats fortextfiles. You don't say which you
want. Also, specify the full path and name of your file.

--
Regards,
Tom Ogilvy

wrote in message

oups.com...



Can anyone describe how to export the values inrangeA1 to F20 on
worksheet'Data' to atextfile? Thetextfile will be named
'routes.txt'. Thetextfile already exists, and it should be
overwritten with the new values each time the macro is executed,
rather than the macro appending the values to thetextfile.


Thanks kindly.


Best Regards,
Joseph- Hide quotedtext-


- Show quotedtext-





 
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
Export range to text file Matthew Scheperle Excel Discussion (Misc queries) 1 March 21st 10 03:30 AM
Simple Export of worksheet contents to text-file. haakon Excel Programming 0 January 22nd 07 12:55 PM
macro to export a range to a text file? [email protected] Excel Programming 4 July 21st 06 02:25 PM
Why can't I Export selected cells to tab-delimited text file? JE McGimpsey Excel Discussion (Misc queries) 1 November 28th 05 05:33 PM
Export range to text file martin Excel Programming 2 August 30th 04 06:39 PM


All times are GMT +1. The time now is 02:52 PM.

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

About Us

"It's about Microsoft Excel"