R
Roman
I have sales information in a data base, I put it in a Excell with out
problem, My boss wanted to see a chart and I did it with the next code.
Dim xlsApp As Excel.Application
Dim xlsCharts As Excel.Chart
…
Set xlsCharts = xlsApp.Application.Charts.Add
xlsCharts.Application.ActiveChart.chartType = 51
(*) xlsCharts.Application.ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("A1: " & Chr(65 + Columna) & Str(Renglon -
1)), PlotBy:=xlColumns
ActiveChart.Location Where:=1
Every thing works at the first time, but when I want to run again the
process for another customer I get an error just in the line (*), Run time
error 1004 'Method 'Sheets' of objects '_Global' failed.
At the end of the function I have code to close the sheet and chart.
Set xlsCharts = Nothing
xlsBook.Close
Set xlsBook = Nothing
xlsApp.Quit
Do I have to close in different way the object charts?
Do I miss something?
Thank you for U help!
problem, My boss wanted to see a chart and I did it with the next code.
Dim xlsApp As Excel.Application
Dim xlsCharts As Excel.Chart
…
Set xlsCharts = xlsApp.Application.Charts.Add
xlsCharts.Application.ActiveChart.chartType = 51
(*) xlsCharts.Application.ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("A1: " & Chr(65 + Columna) & Str(Renglon -
1)), PlotBy:=xlColumns
ActiveChart.Location Where:=1
Every thing works at the first time, but when I want to run again the
process for another customer I get an error just in the line (*), Run time
error 1004 'Method 'Sheets' of objects '_Global' failed.
At the end of the function I have code to close the sheet and chart.
Set xlsCharts = Nothing
xlsBook.Close
Set xlsBook = Nothing
xlsApp.Quit
Do I have to close in different way the object charts?
Do I miss something?
Thank you for U help!