VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Generating Excel Charts with VB6 and display it in the Image Control

by Bhuwan Chand Joshi (69 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 21st July 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



'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.



Download this snippet    Add to My Saved Code

Generating Excel Charts with VB6 and display it in the Image Control Comments

No comments have been posted about Generating Excel Charts with VB6 and display it in the Image Control. Why not be the first to post a comment about Generating Excel Charts with VB6 and display it in the Image Control.

Post your comment

Subject:
Message:
0/1000 characters