Advertisement

05.16.2008 at 01:17AM PDT, ID: 23407614
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.3

Generating multiple charts in one Excel sheet gives compilation error?

Asked by cleany in Active Server Pages (ASP), Microsoft Excel Spreadsheet Software

Tags:

I want to generate more than 1 chart on an Excel sheet.
I managed to make this work for 1 chart per sheet with a different code and found this code for multiple charts.

The problem is, that I get a compilation error on line 19. It says: compilation error: Expected statement.
line19 is:
MyExcelChart.ActiveChart.SetSourceData Source:=MyExcelChart.Sheets("Sheet1").Range(MyRange), PlotBy:=xlColumns

anyone knows how to solve this?Start Free Trial
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"
 
Loading Advertisement...
 
[+][-]05.16.2008 at 03:32AM PDT, ID: 21581524

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 09:12AM PDT, ID: 21584049

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 09:19AM PDT, ID: 21584103

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Active Server Pages (ASP), Microsoft Excel Spreadsheet Software
Tags: Visual Basic
Sign Up Now!
Solution Provided By: rorya
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628