home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch15code
/
olechart.frm
< prev
next >
Wrap
Text File
|
1995-08-12
|
2KB
|
78 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3768
ClientLeft = 1092
ClientTop = 1512
ClientWidth = 6780
Height = 4092
Left = 1044
LinkTopic = "Form1"
ScaleHeight = 3768
ScaleWidth = 6780
Top = 1236
Width = 6876
Begin VB.CommandButton cmdSum
Caption = "Sum Column"
Height = 855
Left = 4560
TabIndex = 2
Top = 2640
Width = 2055
End
Begin VB.CommandButton cmdChart
Caption = "Chart Array"
Height = 855
Left = 120
TabIndex = 1
Top = 2640
Width = 2175
End
Begin VB.OLE oleSheet
Class = "Excel.Sheet.5"
Height = 2292
Left = 4560
OleObjectBlob = "OLECHART.frx":0000
TabIndex = 3
Top = 240
Width = 1932
End
Begin VB.OLE oleChart
Class = "Excel.Chart.5"
Height = 2292
Left = 120
OleObjectBlob = "OLECHART.frx":2818
TabIndex = 0
Top = 240
Width = 4332
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub cmdChart_Click()
Dim objExcel As Object
oleChart.DoVerb
Set objExcel = oleChart.object.Application
objExcel.Run "ChartArray", Array(99, 2, 3, 4, 5)
oleChart.Close
End Sub
Private Sub cmdSum_Click()
Dim objExcel As Object, lTotal As Long
' Activate the embedded worksheet before running the VBA procedure.
oleSheet.DoVerb
' Get a reference to the Excel Application object.
Set objExcel = oleSheet.object.Application
' Run the VBA procedure SumColumn on the first column
lTotal = objExcel.Run("SumColumn", 1)
' Close the OLE object.
oleSheet.Close
' Display the result.
MsgBox lTotal
End Sub