Article ID: 153090
Article Last Modified on 7/2/2004
Option Explicit
Private Sub Command1_Click()
Dim o As Object
Dim i As Integer
Dim iNumbers(1 To 10) As Integer
For i = LBound(iNumbers) To UBound(iNumbers)
iNumbers(i) = Int(Rnd * 100) + 1
Next i
Set o = CreateObject("excel.application")
o.Visible = True
o.Workbooks.Add
o.sheets("sheet1").Range("A1:J1").Value = iNumbers
End Sub
Private Sub Command1_Click()
Dim o As Object
Dim i As Integer
Dim iNumbers(1 To 10) As Integer
Dim iStartRow As Integer
Dim iStartCol As Integer
iStartRow = 1
iStartCol = 1
For i = LBound(iNumbers) To UBound(iNumbers)
iNumbers(i) = Int(Rnd * 100) + 1
Next i
Set o = CreateObject("excel.application")
o.Visible = True
o.Workbooks.Add
o.sheets("sheet1").range(o.cells(iStartRow, iStartCol).address, _
o.cells(iStartRow, ((iStartCol - 1) + _
UBound(iNumbers))).address).Value = iNumbers
End Sub
Keywords: kbhowto kbinterop KB153090