wfs1979
Mar 27th, 2000, 06:31 AM
I've set my references.....
heres my code:
-----------------------------------------------------------
Public Sub open_xls(filename As String)
Dim xlapp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Set xlapp = CreateObject("excel.application")
Set xlbook = xlapp.Workbooks.Open(filename)
Set xlsheet = xlbook.Worksheets(1)
morenum = 10
ReDim numbers(0 To morenum)
'place the value of the cells into variables
Dim n%
************PROBLEM RIGHT HERE**********
Do Until xlsheet.Cells(n, 1).Value = ""
************PROBLEM RIGHT HERE**********
I want my application to read until there it hits a cell w/no value!!!!
If n >= UBound(numbers) Then
Dim evenmorenums%
evenmorenums = morenum + morenum
ReDim Preserve numbers(0 To evenmorenums)
End If
With numbers(n)
.fname = xlsheet.Cells(n + 1, "a")
.phone = xlsheet.Cells(n + 1, "b")
n = n + 1
End With
Loop
ReDim Preserve numbers(LBound(numbers) To (n - 1))
Set xlsheet = Nothing
Set xlbook = Nothing
xlapp.Quit
Set xlapp = Nothing
End Sub
heres my code:
-----------------------------------------------------------
Public Sub open_xls(filename As String)
Dim xlapp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Set xlapp = CreateObject("excel.application")
Set xlbook = xlapp.Workbooks.Open(filename)
Set xlsheet = xlbook.Worksheets(1)
morenum = 10
ReDim numbers(0 To morenum)
'place the value of the cells into variables
Dim n%
************PROBLEM RIGHT HERE**********
Do Until xlsheet.Cells(n, 1).Value = ""
************PROBLEM RIGHT HERE**********
I want my application to read until there it hits a cell w/no value!!!!
If n >= UBound(numbers) Then
Dim evenmorenums%
evenmorenums = morenum + morenum
ReDim Preserve numbers(0 To evenmorenums)
End If
With numbers(n)
.fname = xlsheet.Cells(n + 1, "a")
.phone = xlsheet.Cells(n + 1, "b")
n = n + 1
End With
Loop
ReDim Preserve numbers(LBound(numbers) To (n - 1))
Set xlsheet = Nothing
Set xlbook = Nothing
xlapp.Quit
Set xlapp = Nothing
End Sub