Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for sending cells B6:J10 to text file.

Hi,

Can you show me VBA code that copies contents of cells B6:J10 into a
plain text file?
By contents I mean the actual data and not the formulas, etc.

I cannot use "Save As" CSV because this data changes often so I need to
automate this process.


Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA code for sending cells B6:J10 to text file.

Sub MakeCSV()
Dim sh As Worksheet
Set sh = ActiveSheet
Workbooks.Add Template:=xlWBATWorksheet
sh.Range("B6:J10").Copy Destination:= _
ActiveWorkbook.Worksheets(1).Range("A1")
ActiveWorkbook.SaveAs Filename:="C:\MyCSV\" & _
Format(Now, "yymmdd_hh_mm") & ".csv", _
FileFormat:=xlCSV
ActiveWorkbook.Close SaveChanges:=False
End Sub


--
Regards,
Tom Ogilvy




"lothario" wrote in message
...
Hi,

Can you show me VBA code that copies contents of cells B6:J10 into a
plain text file?
By contents I mean the actual data and not the formulas, etc.

I cannot use "Save As" CSV because this data changes often so I need to
automate this process.


Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default VBA code for sending cells B6:J10 to text file.

See the TextWrite section on this WebSite.


http://www.tushar-mehta.com/excel/so...ram/index.html

Chip Pearson has some great examples on his WebSite.

http://www.cpearson.com/excel/imptext.htm

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
Hi,

Can you show me VBA code that copies contents of cells B6:J10 into a
plain text file?
By contents I mean the actual data and not the formulas, etc.

I cannot use "Save As" CSV because this data changes often so I need to
automate this process.


Thanks,
Luther


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for sending cells B6:J10 to text file.

Thank you.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default VBA code for sending cells B6:J10 to text file.

Hi Luther

It's ready-to-use in the last part of Chip's page
http://www.cpearson.com/excel/imptext.htm

--
HTH. Best wishes Harald
Followup to newsgroup only please

"lothario" skrev i melding
...
Hi,

Can you show me VBA code that copies contents of cells B6:J10 into a
plain text file?
By contents I mean the actual data and not the formulas, etc.

I cannot use "Save As" CSV because this data changes often so I need to
automate this process.


Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA code for sending cells B6:J10 to text file.

Luther,
The following will work:

sub test()
Range("B6:J10").select
ActiveWorkbook.SaveAs Filename:="C:\yourpath\test.txt", FileFormat:=xlText, _
CreateBackup:=False
end sub


Regards
Nigel


lothario wrote in message ...
Hi,

Can you show me VBA code that copies contents of cells B6:J10 into a
plain text file?
By contents I mean the actual data and not the formulas, etc.

I cannot use "Save As" CSV because this data changes often so I need to
automate this process.


Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for sending cells B6:J10 to text file.

Thank you.
I appreciate all the help.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

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 - Sending file using File/Send to/Mail Recipient Dawn Excel Discussion (Misc queries) 0 March 21st 10 09:24 PM
Excel - Sending file using File/Send to/Mail Recipient Dawn Excel Discussion (Misc queries) 0 March 21st 10 09:20 PM
Code to create dbase file from text file? Hilton Excel Discussion (Misc queries) 0 October 9th 08 10:37 AM
Sending E-Mail by code ASU Excel Discussion (Misc queries) 2 June 13th 06 01:17 PM
Mocro code for sending a worksheet in a mail message Lorenzo Excel Discussion (Misc queries) 1 August 31st 05 10:49 PM


All times are GMT +1. The time now is 10:46 AM.

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"