excelerator
Bioengineer
- Aug 9, 2002
- 1
Hi,
I have tried to create an excel chart from an asp page on my intranet. However certain methods can't be used.
unable to set the Title.
Everything else seems to work out fine.
Any idea of a cause or solution.
Thanks in advance
Dim xlApp
Dim xlBook
Dim xlSheet
Dim MyExcelChart
Set xlApp = CreateObject("Excel.Application"
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
Set MyExcelChart = xlBook.Charts.Add
' show or dont show excel to user, TRUE or FALSE
'MyExcelChart.Application.Visible = True
' populate the cells
xlsheet.Range("B2:k2".Value = Array("Week1", "Week2", "Week3", "Week4", "Week5", "Week6", "Week7", "Week8", "Week9", "Week10"
xlsheet.Range("B3:k3".Value = Array("67", "87", "5", "9", "7", "45", "45", "54", "54", "10"
xlsheet.Range("B4:k4".Value = Array("10", "10", "8", "27", "33", "37", "50", "54", "10", "10"
xlsheet.Range("B5:k5".Value = Array("23", "3", "86", "64", "60", "18", "5", "1", "36", "80"
xlsheet.Cells(3,1).Value="Internet Explorer"
xlsheet.Cells(4,1).Value="Netscape"
xlsheet.Cells(5,1).Value="Other"
with MyExcelChart
' Format the chart, set type of chart, shape of the bars, show title, get the data for the chart, show datatable, show legend
.ChartType = 97
.BarShape = 0
-------------------------
' this gives an error'.HasTitle = True
'.ChartTitle.Text = "Visitors log for each week shown in browsers percentage"
-------------------
.SetSourceData xlbook.Sheets("Sheet4".Range("A1:k5",1
.Location 1
.HasDataTable = True
.DataTable.ShowLegendKey = True
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "sDens"
end with
' Save the the excelsheet to chart.xls
xlsheet.SaveAs "c:\charts2.xls"
xlbook.close
xlapp.quit
I have tried to create an excel chart from an asp page on my intranet. However certain methods can't be used.
unable to set the Title.
Everything else seems to work out fine.
Any idea of a cause or solution.
Thanks in advance
Dim xlApp
Dim xlBook
Dim xlSheet
Dim MyExcelChart
Set xlApp = CreateObject("Excel.Application"
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
Set MyExcelChart = xlBook.Charts.Add
' show or dont show excel to user, TRUE or FALSE
'MyExcelChart.Application.Visible = True
' populate the cells
xlsheet.Range("B2:k2".Value = Array("Week1", "Week2", "Week3", "Week4", "Week5", "Week6", "Week7", "Week8", "Week9", "Week10"
xlsheet.Range("B3:k3".Value = Array("67", "87", "5", "9", "7", "45", "45", "54", "54", "10"
xlsheet.Range("B4:k4".Value = Array("10", "10", "8", "27", "33", "37", "50", "54", "10", "10"
xlsheet.Range("B5:k5".Value = Array("23", "3", "86", "64", "60", "18", "5", "1", "36", "80"
xlsheet.Cells(3,1).Value="Internet Explorer"
xlsheet.Cells(4,1).Value="Netscape"
xlsheet.Cells(5,1).Value="Other"
with MyExcelChart
' Format the chart, set type of chart, shape of the bars, show title, get the data for the chart, show datatable, show legend
.ChartType = 97
.BarShape = 0
-------------------------
' this gives an error'.HasTitle = True
'.ChartTitle.Text = "Visitors log for each week shown in browsers percentage"
-------------------
.SetSourceData xlbook.Sheets("Sheet4".Range("A1:k5",1
.Location 1
.HasDataTable = True
.DataTable.ShowLegendKey = True
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "sDens"
end with
' Save the the excelsheet to chart.xls
xlsheet.SaveAs "c:\charts2.xls"
xlbook.close
xlapp.quit