Advertisement
Advertisement
| 05.16.2008 at 01:17AM PDT, ID: 23407614 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: |
'Make the object, and set the object to an Excelsheet
Dim MyExcelChart, MyRange
Set MyExcelChart = wscript.CreateObject("Excel.Sheet")
b = MyExcelChart.ActiveSheet.Shapes.Count ' if there are other Shapes in ActiveSheet
' show or dont show excel to user, TRUE or FALSE
MyExcelChart.Application.Visible = True
For a = 1 To 3
MyRange = MyExcelChart.ActiveSheet.Range(MyExcelChart.Sheets("Sheet1").Cells(a * 10 - 9, 1), MyExcelChart.Sheets("Sheet1").Cells(a * 10 - 5, 2)).Address(0, 0)
' Select the contents that need to be in the chart
'MyExcelChart.ActiveSheet.Range(MyExcelChart.Sheets("Sheet1").Cells(a * 10 - 9, 1), MyExcelChart.Sheets("Sheet1").Cells(a * 10 - 5, 2)).Select
MyExcelChart.Charts.Add
MyExcelChart.ActiveChart.ChartType = 20
MyExcelChart.ActiveChart.BarShape =3
MyExcelChart.ActiveChart.HasTitle = True
MyExcelChart.ActiveChart.ChartTitle.Text = "ok"
MyExcelChart.ActiveChart.SetSourceData Source:=MyExcelChart.Sheets("Sheet1").Range(MyRange), PlotBy:=xlColumns
MyExcelChart.ActiveChart.Location 1
MyExcelChart.ActiveSheet.Shapes(a + b).Name = "MyChart" & a
With MyExcelChart.ActiveSheet.Shapes("MyChart" & a)
.Top = MyExcelChart.Sheets("Sheet1").Range(MyRange).Top
.Height = MyExcelChart.Sheets("Sheet1").Range(MyRange).Height * 1.9
.Width = MyExcelChart.Sheets("Sheet1").Range(MyRange).Width * 1.9
End With
MyExcelChart.ActiveChart.HasDataTable = False
MyExcelChart.ActiveChart.DataTable.ShowLegendKey = False
Next
' Save the the excelsheet to chart.xls
MyExcelChart.SaveAs "c:\export.xls"
|