Chart question using xl3DColumn constant.

Posted on 2007-03-26
Medium Priority
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?


    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

Question by:akohan
  • 2
  • 2

Author Comment

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:


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

What should I do now?!

LVL 85

Expert Comment

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

Author Comment

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).


LVL 85

Accepted Solution

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.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Are you looking to start a business? Do you own and operate a small company? If so, here are some courses you need to take before you hire a full-time IT staff.
What to do if a split doesn't fit? Or a bunch of invoice lines must be rounded while the sum must match a total? It takes a little, but - when done - it is extremely easy to implement.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

600 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