
Please Help with Excel Files/Arrays
Quote:
> As a Novice to/in VB script I need help in how to import to an array
> or access from 2 to 50 cell entries in an Excel spreadsheet so that I
> can use a FOR ....Each statement to automate making merge and order files for
> each cell entry to produce data CD's.
> Nothing I have tried works.
> Please Help if you can.
> Wayne
With help from Tom Lavedas the code below will echo the value in each row;
however I have not been able to come up with a way to use the individual values
to generate the listed files I need.
Please, Please Help if you can
*******************************
Dim WorkSheet, oXL, Row, Col, i
WorkSheet = "c:\agency.xls"
Set oXL = CreateObject("Excel.Application")
oXL.Visible = False
oXL.WorkBooks.Open WorkSheet
Row = 1
Col = 1
Do Until IsEmpty(oXL.Cells(Row, Col))
' ReDim Preserve aCells(Col - 1)
' aCells(Col - 1) = oXL.Cells(Row, Col)
' Col = Col + 1
ReDim Preserve aCells(Row - 1)
aCells(Row - 1) = oXL.Cells(Row, Col)
Row = Row + 1
Loop
oXL.DisplayAlerts = False
oXL.Quit
For i = 0 to Ubound(aCells)
wscript.echo aCells(i)
Next
' Dim fso, MergeFile
' Set fso = CreateObject("Scripting.FileSystemObject")
' Set MergeFile = fso.CreateTextFile("c:\"aCells(i)".txt", True)
' MergeFile.WriteLine(aCells(i))
' MergeFile.Close
' Dim gso, OrdFile
' Set gso = CreateObject("Scripting.FileSystemObject")
' Set OrdFile = gso.CreateTextFile("c:\order.ord", True)
' OrdFile.WriteLine("order_id = number")
' OrdFile.WriteLine("file = c:\vbs\number\")
' OrdFile.WriteLine("label = c:\vbs\sprint_test01.btw")
' OrdFile.WriteLine("labtype = EDITOR_FMT")
' OrdFile.WriteLine("merge = c:\vbs\number.txt")
' OrdFile.Close
.