Builtin chart type internationalization

S

Stumped

Hi,
My VB program uses Excel's built in custom type chart
called Smooth Lines. I use the following code to call it:

Excel.ActiveChart.ApplyCustomType ChartType:=xlBuiltIn,
TypeName:="Smooth Lines"

This works fine in an English version Excel but when you
have a German Excel it causes an error and says that the
type name is not applicable. The reason for this is
because the German version of Excel calls the Smooth
Lines as Weiche Linien and if I replace the Smooth Lines
type name with Weiche Linien, it works.

The only solution I could come up with are either:
1. Create my chart with all the properties of Smooth
Lines chart. The chart I created has all the properties
of Smooth Lines except the width is a little off. This is
basically what I have in my VB program:
With .ActiveChart
.ChartType = xlLine
.BarShape = xlBox
.DepthPercent = 100
.DisplayBlanksAs = xlNotPlotted
.GapDepth = 150
.HasDataTable = False
.HasLegend = True
.HasPivotFields = False
.HasTitle = False
.PlotVisibleOnly = True
.PlotBy = xlRows
.ProtectData = False
.ProtectFormatting = False
.ProtectGoalSeek = False
.ProtectSelection = False
.SizeWithWindow = False
.Visible = xlSheetVisible
.WallsAndGridlines2D = False
End With

With .ActiveChart.Axes(xlValue)
If .HasMajorGridlines Then
.MajorGridlines.Border.ColorIndex = 2
End If
End With
.ActiveChart.Axes(xlCategory).CategoryType =
xlCategoryScale
.ActiveChart.Axes
(xlCategory).AxisBetweenCategories = False

This is not a bad alternative to me but a little
complicated. If I want to use another built in custom
type, I would have to find out all the properties and
compare the physical attributes to my new chart.

2. The second alternative is to open the Smooth Lines
chart and save is as a user defined chart (xlusrgal.xls)
but this will overwrite the user's existing xlusrgal.xls
file and I don't want to do that.

Does anyone have any suggestions on this? Thank you very
much!!
 
S

Stephen Bullen

If you are already shipping a workbook as part of your application, you
could include a chart made from the 'Smooth Lines' format inside the
workbook, then copy it and paste special > Formats to the new chart.

Personally though, I'd create the chart based on the closest standard
chart type (i.e. one of the xlChartStyle constants), then change
whichever properties needed changing.


Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk
 
G

Guest

Thanks! That seems to work really good. The closest to
Smooth Lines is xlLineMarkers and I just changed a couple
of the properties and both charts look identical now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top