Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlexcel As Excel.Worksheet
Dim sRef As String
Dim c As Variant
Dim n As Integer
On Error GoTo excelProb
' Open new instance of Excel
Set xlApp = New Excel.Application
' Open workbook
Set xlBook = xlApp.Workbooks.Open("v:\wam\bo upgrade\invoice\sept 2001\sw test.xls"
' Reference the first sheet
Set xlexcel = xlBook.Worksheets(2)
' Get first value from cell 10 (first column)
sRef = xlexcel.Cells(10, 1).Value
n = 10
Do While sRef <> ""
n = n + 1
sRef = xlexcel.Cells(n, 1).Value
Loop
n = n - 1
' EXCEL DOESN'T LIKE THE NEXT LINE
xlexcel.Range("A10" & n).Select
'Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Cheers,
Nick
Dim xlBook As Excel.Workbook
Dim xlexcel As Excel.Worksheet
Dim sRef As String
Dim c As Variant
Dim n As Integer
On Error GoTo excelProb
' Open new instance of Excel
Set xlApp = New Excel.Application
' Open workbook
Set xlBook = xlApp.Workbooks.Open("v:\wam\bo upgrade\invoice\sept 2001\sw test.xls"
' Reference the first sheet
Set xlexcel = xlBook.Worksheets(2)
' Get first value from cell 10 (first column)
sRef = xlexcel.Cells(10, 1).Value
n = 10
Do While sRef <> ""
n = n + 1
sRef = xlexcel.Cells(n, 1).Value
Loop
n = n - 1
' EXCEL DOESN'T LIKE THE NEXT LINE
xlexcel.Range("A10" & n).Select
'Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Cheers,
Nick