M
msnews.microsoft.com
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
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