- Home
·
- Graphics
·
- Generating Excel Charts with VB6 and display it in the Image Control
Generating Excel Charts with VB6 and display it in the Image Control
Generating Excel Charts with VB6 and display it in the Image Control
Rate Generating Excel Charts with VB6 and display it in the Image Control
(1(1 Vote))
'Generating Charts:
'Need to create xls file with Microsoft Excel
'Open a standard exe form
'Place a Image control over the form
'Make a reference to Microsoft Excel 8.0 Object Libraray
Private sub Form_Load()
Dim xlApp As excel.Application
Set xlApp = New excel.Application
Dim xlWkb As excel.Workbook
Set xlWkb = xlApp.Workbooks.Open("Specify the path of xls file to get data")
Dim xlSht As excel.Worksheet
Set xlSht = xlWkb.Worksheets(1)
Dim xlChart As excel.Chart
Set xlChart = xlWkb.Charts.Add
xlChart.ChartType = xl3DLine
xlChart.SetSourceData xlSht.Range("Specify range over here like A2:B6"), xlColumns
xlChart.Visible = xlSheetVisible
xlChart.Legend.Clear
xlChart.ChartArea.Font.Size = 15
xlChart.ChartArea.Font.Color = vbRed
xlChart.ChartArea.Select
xlChart.ChartArea.Copy
Image1.Picture = Clipboard.GetData(vbCFBitmap)
End Sub
'Run the application and you see the chart image in the Image Control. You can use the same procedures to generate multiple type of charts.
Generating Excel Charts with VB6 and display it in the Image Control Comments
No comments yet — be the first to post one!
Post a Comment