lpatnaik
Programmer
- Jul 11, 2002
- 53
Hi,
I am creating a report using excel template. I have to create charts and then put them up on a chart sheet (4 or more charts in one CHART SHEET, not worksheet). The following code creates the chart and them puts them on a chart named as in code. But whenever i open the excel file to view the report, the charts are on the fisrt worksheet of the excel file rather than on the chart sheet. I have tried out a lot on this.
KIndly help!!!!
Set cht = objBook.Charts.Add
Set cht = cht.Location(xlLocationAsObject, "DRE_Chart"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
With cht
.ChartType = xlPie
.SetSourceData Source:=objSheet.Range(objSheet.Cells(8, 3), objSheet.Cells(10, 5))
.HasTitle = True
.ChartTitle.Text = "DRE for phase " & strPhaseName
.ApplyDataLabels (xlDataLabelsShowLabelAndPercent)
.PlotArea.Border.Weight = xlThin
.PlotArea.Border.LineStyle = xlNone
.PlotArea.Interior.ColorIndex = xlNone
.PlotBy = xlRows
.LocationxlLocationAsObject, "DRE_Chart"
'I tried to set it again like this , still it wont work
End With
I am creating a report using excel template. I have to create charts and then put them up on a chart sheet (4 or more charts in one CHART SHEET, not worksheet). The following code creates the chart and them puts them on a chart named as in code. But whenever i open the excel file to view the report, the charts are on the fisrt worksheet of the excel file rather than on the chart sheet. I have tried out a lot on this.
KIndly help!!!!
Set cht = objBook.Charts.Add
Set cht = cht.Location(xlLocationAsObject, "DRE_Chart"
With cht
.ChartType = xlPie
.SetSourceData Source:=objSheet.Range(objSheet.Cells(8, 3), objSheet.Cells(10, 5))
.HasTitle = True
.ChartTitle.Text = "DRE for phase " & strPhaseName
.ApplyDataLabels (xlDataLabelsShowLabelAndPercent)
.PlotArea.Border.Weight = xlThin
.PlotArea.Border.LineStyle = xlNone
.PlotArea.Interior.ColorIndex = xlNone
.PlotBy = xlRows
.LocationxlLocationAsObject, "DRE_Chart"
'I tried to set it again like this , still it wont work
End With