Article ID: 112443
Article Last Modified on 1/8/2003
Const OLE_CREATE_EMBED = 0 Const OLE_ACTIVATE = 7
Sub Command1_Click()
ole1.Class = "Excel.Sheet.5"
ole1.Action = OLE_CREATE_EMBED
End Sub
Sub Command2_Click ()
ole1.Action = OLE_ACTIVATE
ole1.Object.cells(1, 1).value = "Jan"
ole1.Object.cells(2, 1).value = 3
ole1.Object.cells(3, 1).value = 4
ole1.Object.cells(4, 1).value = 6
End Sub
The "ole1.Object" part is Visual Basic code. The rest of the line
(cells(2,1).value = 1) is Excel's Visual Basic for Applications code.
Sub Command3_Click()
ole1.Action = OLE_ACTIVATE
ole1.Object.Range("A2:A4").Select
' Try any one of the following lines, or add some pauses between
' them to see the selections taking place and the active cell
' changing.
' To try a line, remove the single quotation mark to uncomment the
' line:
' ole1.Object.Range("C6").Activate
' ole1.Object.cells(6, 1).value = "=SUM(R2C:R4C)"
' ole1.Object.Range("A6").Select
End Sub
Additional query words: W_VBApp
Keywords: kbhowto kbprogramming kb16bitonly KB112443