0
我已经写了VBScript代码来添加Excel的页面1中的图表,源代码是来自其他名称为“CL.1.1”的Excel表格,但我得到上面的错误可以帮助我解决以下代码中的错误。运行时错误1004,应用程序定义或对象定义的错误
Sub DispvsTime(Shname)
Sheets("Sheet1").Select
noofsheets = ActiveSheet.ChartObjects.Count
If noofsheets > 0 Then
ActiveSheet.ChartObjects.Select
ActiveSheet.ChartObjects.Delete
End If
Sheets("Sheet1").Pictures.Visible = False
ActiveSheet.Shapes.AddChart(1000, 420, 50, 500).Select
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData Source:=Sheets("Shname").Range("G2:H2001")
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveChart.ChartTitle.Text = "Displacement VS Time"
End Sub
这里“shname”是选择数据的工作表的名称。
实际上,我只在我调试代码的时候使用了shname,它给出了表格的正确名称。 shname变量被替换为实际值,但我仍然面临着这个问题 – surendra 2013-05-10 10:01:34