Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VB Code - Chart Type problem

Status
Not open for further replies.

Killian01

Technical User
Feb 1, 2001
36
GB
I am writing a macro that needs to indentify the active chart type, which should be fine but when interrogating any XYScatter OR Bubble(!!) chart, the value returned is always -4169 (for xlXYScatter) See code example below...
I need to separate my Bubbles from my Scatters! Help!

Killian :)

With a chart selected, run this code for a dialog box displaying the chart type code

'**************************************************
Dim Msg, Style, Title, Response
Msg = "Chart Type is" & " " & ActiveChart.Type
Style = vbOKCancel + vbInformation
Title = "ML DTP Chart Tools"
Response = MsgBox(Msg, Style, Title)

'**************************************************

Chart Codes:

 
Hello, Killian01.

Should use ChartType proper to Chart Object. In other words, use instead :

Msg = "Chart Type is" & " " & ActiveChart.ChartType

or better, if not absolutely necessary,

Msg = "Chart Type is" & " " & CStr(ActiveChart.ChartType)

regards - tsuji
 
Thanks tsuji

I got my marcos to work by defining a string variable for the chart type and testing against that but I'll revise it to use .ChartType rather than .Type

I foolishly assumed they'd return the same thing... doh!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top