![]() |
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/ |
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/ |
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 |
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/ |
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/ |
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/ |
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/ |
All times are GMT +1. The time now is 02:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com