'在运行此程序之前先引用Microsoft Graph x.0 Object LibraryDim myChart As graph.ApplicationPrivate Sub Command1_Click()
Dim i As Integer
Dim j As Integer
On Error GoTo PROC
Set myChart = graph.Application'填加随机数
For i = Asc("A") To Asc("L")
For j = 1 To 8
myChart.Application.DataSheet.Range(Chr(i) & j).Value = Rnd()
Next
NextWith myChart.Application.Chart
.Axes (xlCategory)
.HasTitle = True
.AxisTitle.Text = "这是坐标轴上标题的位置" '此处运行不下去
End With'指定图表的标题
myChart.Application.Chart.ChartTitle.Text = "这是图表标题的置"
myChart.Visible = True
Set myChart = Nothing
Exit Sub
PROC:
MsgBox Err.Description
End Sub问题:
我曾直接copyMSDN里的各种例子,但都不能正常运行,可能是对象没定义好(不会正确定义对象变量,怎样去定义它才能保障程序正常运行????
Dim i As Integer
Dim j As Integer
On Error GoTo PROC
Set myChart = graph.Application'填加随机数
For i = Asc("A") To Asc("L")
For j = 1 To 8
myChart.Application.DataSheet.Range(Chr(i) & j).Value = Rnd()
Next
NextWith myChart.Application.Chart
.Axes (xlCategory)
.HasTitle = True
.AxisTitle.Text = "这是坐标轴上标题的位置" '此处运行不下去
End With'指定图表的标题
myChart.Application.Chart.ChartTitle.Text = "这是图表标题的置"
myChart.Visible = True
Set myChart = Nothing
Exit Sub
PROC:
MsgBox Err.Description
End Sub问题:
我曾直接copyMSDN里的各种例子,但都不能正常运行,可能是对象没定义好(不会正确定义对象变量,怎样去定义它才能保障程序正常运行????
解决方案 »
- API强制关闭IE窗口内的WEBBROWSER控件
- 如何把系统服务设置成为自动.手动.禁止状态?(高手请帮帮忙)
- 在VB中如何用代码实现窗口随分辩率大小而自动变化?
- 打包后安装出现注册msADO25.tlb时出现错误
- 我想在ROSE上用VB做一个插件,但是在VB的插件模板上没有ROSE应用程序选项,谁能告诉我怎么加?
- 学生管理信息系统用户登录问题
- 為什么用ADO的recordset對象返回的recordcount總是為 '-1'
- vb6.0编译时报Bad file name or number是什么问题? 急在线等
- 请教一个简单的VB问题。如何使用ADO的连接来压缩ACCESS2000数据库。
- 各位玩StarCraft的程序员兄,本周末我们相聚263站网,请看:http://www.csdn.net/expert/Topic/47182.shtm
- 请教单击标签倥件(内容为邮箱地址),能够启动outlook并自动填上邮箱地址
- err.Raise 的问题
也是这个问题
With myChart.Application.Chart
.Axes (xlCategory)
.HasTitle = True
'.AxisTitle.Text = "这是坐标轴上标题的位置" '此处运行不下去
End With没有axistitle属性,可能这个属性不在Chart中
如:
With myChart.Application.Chart.分类轴
Dim i As Integer
Dim j As Integer
On Error GoTo PROC
Set myChart = Graph.Application'填加随机数
For i = Asc("A") To Asc("L")
For j = 1 To 8
myChart.Application.DataSheet.Range(Chr(i) & j).Value = Rnd()
Next
NextWith myChart.Application.Chart
With .Axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "这是横坐标轴上标题的位置"
End With
With .Axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "这是纵坐标轴上标题的位置"
End With
'指定图表的标题
.HasTitle = True
.ChartTitle.Text = "这是图表标题的置"
End WithmyChart.Visible = True
Set myChart = Nothing
Exit Sub
PROC:
MsgBox Err.Description
End Sub
我改进了一下Dim myChart As Graph.ApplicationPrivate Sub Command1_Click()
Dim i As Integer
Dim j As Integer
On Error GoTo PROC
Set myChart = Graph.Application'填加随机数
For i = Asc("A") To Asc("L")
For j = 1 To 8
myChart.Application.DataSheet.Range(Chr(i) & j).Value = Rnd()
Next
NextWith myChart.Application.Chart.Axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "这是横坐标轴上标题的位置"
End With
With myChart.Application.Chart.Axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "这是纵坐标轴上标题的位置"
End With
With myChart.Application.Chart
'指定图表的标题
.HasTitle = True
.ChartTitle.Text = "这是图表标题的置"
End WithmyChart.Visible = True
Set myChart = Nothing
Exit Sub
PROC:
MsgBox Err.Description
End Sub