Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating properly formatted text file from vbscript using excel data
I have an excel spreadsheet named test.xls with A1:B2 populated this way:
A B ~ ~ 1 2 3 4 What I want to do from VBScript is copy that data and export it to a tab deliminated text file. For example, I can create a document called hello.txt and in it, it would have 1 2 3 4 I just started playing around with this and have the following so far: '================================ Dim Xl Dim myData myData="" Set Xl = CreateObject("Excel.Application") Xl.Workbooks.Open("C:\test.xls") Xl.Sheets("Sheet1").Select for each r in Xl.Range("A1","B2") myData = myData & r.value & vbTab next msgbox myData Set Xl = Nothing '================================ I haven't created the text file yet (that's trivial). The problem is that the output comes as follows: 1 2 3 4 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Line Chart from office 2003.xls not formatted properly in 2007 | Excel Discussion (Misc queries) | |||
CSV file doesn't save "xEy" style number as text formatted data | Excel Discussion (Misc queries) | |||
Converting formatted text into a txt file | Excel Discussion (Misc queries) | |||
Reading in poorly formatted text file | Excel Discussion (Misc queries) | |||
Need help with creating a text file via excel | Excel Worksheet Functions |