VB 使用Excel图表制作柱图,求解,并求有代码的例子或者代码例子的连接(万分感谢)
小弟在网上查了很久了,也没有发现关于这方面的资料,不知道是人笨了,还是关键字输入没有找准,总之是蛋疼了很久,所以小弟想在这里来求教各位大侠,望各位发发善心,小弟感激不尽
语言是 VB6.0
小弟添加引用了 Microsoft Excel 11.0 Library 和 添加了Excel图表组件,请问各位这个怎么使用?求解,跪求,谢谢
[解决办法]
Sub Macro1()
'
' Macro1 Macro
' 宏由 微软用户 录制,时间: 2011-12-16
'
'
Range("A1").Select
ActiveCell.FormulaR1C1 = "1"
Range("B1").Select
ActiveCell.FormulaR1C1 = "10"
Range("A2").Select
ActiveCell.FormulaR1C1 = "2"
Range("A3").Select
ActiveCell.FormulaR1C1 = "3"
Range("A4").Select
ActiveCell.FormulaR1C1 = "4"
Range("A5").Select
ActiveCell.FormulaR1C1 = "5"
Range("A6").Select
ActiveCell.FormulaR1C1 = "6"
Range("A7").Select
ActiveCell.FormulaR1C1 = "7"
Range("A8").Select
ActiveCell.FormulaR1C1 = "8"
Range("A9").Select
ActiveCell.FormulaR1C1 = "9"
Range("A10").Select
ActiveCell.FormulaR1C1 = "10"
Range("B2").Select
ActiveCell.FormulaR1C1 = "12"
Range("B3").Select
ActiveCell.FormulaR1C1 = "32"
Range("B4").Select
ActiveCell.FormulaR1C1 = "24"
Range("B5").Select
ActiveCell.FormulaR1C1 = "56"
Range("B6").Select
ActiveCell.FormulaR1C1 = "14"
Range("B7").Select
ActiveCell.FormulaR1C1 = "80"
Range("B8").Select
ActiveCell.FormulaR1C1 = "14"
Range("B9").Select
ActiveCell.FormulaR1C1 = "23"
Range("B10").Select
ActiveCell.FormulaR1C1 = "7"
Range("A1:B10").Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:B10"), PlotBy _
:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub