?
Solved

Chart question using xl3DColumn constant.

Posted on 2007-03-26
5
Medium Priority
?
709 Views
Last Modified: 2008-02-01
Hello group,

In the following code; during runtime whenever I choose the third item from the
array (ar_ChartFormat(3) = xl3DColumn) and I look at the log file I can see "type : -4100" but the rest of the options are logged as normal values such as 51,53 and ... In fact, this causes mismatch type for the generated chart.

I'm using same constant value but on this specific item I'm having problem! What is the problem here?

Code:



    ar_ChartFormat(1) = xlColumnClustered
    ar_ChartFormat(2) = xl3DColumnClustered
    ar_ChartFormat(3) = xl3DColumn
    ar_ChartFormat(4) = xlColumnStacked
    ar_ChartFormat(5) = xl3DColumnStacked
    ar_ChartFormat(6) = xlColumnStacked100
    ar_ChartFormat(7) = xl3DColumnStacked100
   
    ar_ChartFormat(8) = xlLine
    ar_ChartFormat(9) = xlLineMarkers
    ar_ChartFormat(10) = xl3DLine
    ar_ChartFormat(11) = xlLineStacked
    ar_ChartFormat(12) = xlLineMarkersStacked
    ar_ChartFormat(13) = xlLineStacked100
    ar_ChartFormat(14) = xlLineMarkersStacked100
   
    ar_ChartFormat(15) = xlPie
    ar_ChartFormat(16) = xlPieExploded
    ar_ChartFormat(17) = xl3DPie
    ar_ChartFormat(18) = xl3DPieExploded
    ar_ChartFormat(19) = xlPieOfPie
    ar_ChartFormat(20) = xlBarOfPie
   
   
    With ActiveSheet.ChartObjects.Add(Left:=100, Width:=375, Top:=75, Height:=225)
   
        .Chart.SetSourceData Source:=ActiveSheet.Range(strSelectedRange)
       
        LogInformation ("type: " & CStr(ar_ChartFormat(CInt(tvCtrlChartType.SelectedItem.Index - 3))))
       
        .Chart.ChartType = ar_ChartFormat(CInt(tvCtrlChartType.SelectedItem.Index - 3))

       
    End With

regards,
ak
0
Comment
Question by:akohan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Author Comment

by:akohan
ID: 18796440

Ok. I found the cause. After a chart is created on worksheet it is selected by default.  If I try to create a new one since the previous chart is still active or selected will cause "type mismatch" error!

So what I did was calling Deselect method. Now the new problem is that the compiler doesn't like this statement:

                   ActiveChart.Deselect

and causes another error message: "Object Varialbe or With block variable not set"

What should I do now?!

thanks,
ak
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 18798711
That would imply that you do not have a chart activated.
0
 

Author Comment

by:akohan
ID: 18804743

Would you please explain what you mean?

As far as I know DSELECT method belongs to Chart class. So it shouldn't cause a problem.

Also as soon as a chart is plotted or created, I can see that it is selected (at least by seeing the frame around it and small boxes on each side).

regards,
ak

0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 1000 total points
ID: 18806522
Deselect does belong to the chart class, but if there is no chart active, then you will get that message if you use Activechart. Running your code does not, at least in Excel 2002, result in the new chart being active, so you will get that error.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question