我正在尝试将这些数据连接到我的图表,但是出现了应用程序定义或对象定义的错误。
Dim chtObj As ChartObject
For Each chtObj In ActiveSheet.ChartObjects
chtObj.Delete
Next
Dim myChartObject As ChartObject
Set myChartObject = Application.Workbooks(file_name).Worksheets("PP_DETAILS").ChartObjects.Add(Left:=200, Top:=200, Width:=400, Height:=300)
Application.Workbooks(file_name).Worksheets("PP_DETAILS").Range("M2:M7").Select
Application.Workbooks(file_name).Worksheets("PP_DETAILS").ChartObjects.SetSourceData Source:=Range("PP_DETAILS!$M$2:$M$7")
Application.Workbooks(file_name).Worksheets("PP_DETAILS").ChartObjects.ChartType = xlColumnClustered