Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Creating charts in non-English versions of Excel
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Peter T, post: 6226074"] Actually Jon gave good advice, as he implied there are other reasons trying to apply chart types from the gallery might fail. A "fairly sophisticated Excel AddIn that generates all sorts of Charts" ought generate a custom chart to needs. Anyway and FWIW, this is what I had in mind as a workaround. It relies on two big assumptions - 1. When first attempting to apply a built in custom chart type XL8galry.xls opens and can be accessed (invisible but can see it in the VBE). It always does for me but can't be sure if it does for all. 2. Apart from the Chart names, XL8galry.xls is identical in all XL versions and languages, in particular the charts are in same order in different language versions. I can't test this at all. Sub Test() Dim sTypeName As String Dim ch As Chart On Error GoTo errH sTypeName = "Linie - Säule" ' "Line - Column" 'sTypeName = "Linie - Säule auf zwei Achsen" '"Line - Column on 2 Axes" ' more tests Set ch = ActiveChart If ch Is Nothing Then MsgBox "no chart is selected" Exit Sub End If On Error GoTo errBuiltIn: ch.ApplyCustomType ChartType:=xlBuiltIn, TypeName:=sTypeName ' regular error handler On Error GoTo errH ' more code Exit Sub errBuiltIn: If TranslateBuiltInName(sTypeName) Then Resume 'Else ' Resume Next ' or Resume elsewhere or handle somehow End If Exit Sub errH: MsgBox Err.Description, , Err.Number End Sub Function TranslateBuiltInName(ByRef sName) As Boolean Dim i As Long Dim sLocalName As String Dim sErrMsg As String Dim vArr Dim ch As Chart Dim wb As Workbook Static col As Collection On Error GoTo errH If col Is Nothing Then ' the order of charts in XL8galry.xls in English XL2000 vArr = Array("dummy", _ "Outdoor Bars", "Logarithmic", "Column - Area", _ "Lines on 2 Axes", "Line - Column on 2 Axes", _ "Line - Column", "Smooth Lines", "Cones", _ "Area Blocks", "Tubes", "Pie Explosion", _ "Stack of Colors", "Columns with Depth", "Blue Pie", _ "Floating Bars", "Colored Lines", "B&W Column", _ "B&W Line - Timescale", "B&W Area", "B&W Pie") Set col = New Collection 100 Set wb = Workbooks("XL8GALRY.XLS") If wb Is Nothing Then Err.Raise 12345 101 For Each ch In wb.Charts i = i + 1 col.Add ch.Name, vArr(i) Next End If 200 sLocalName = col(sName) 201 sName = sLocalName TranslateBuiltInName = True Exit Function errH: Select Case Erl Case 100: sErrMsg = "Cannot access XL8galry.xls" Case 200: sErrMsg = sName & vbCr & "does not exist in XL8galry.xls" Case Else: sErrMsg = "unexpected error" & vbCr & Err.Description End Select MsgBox sErrMsg End Function If this works (big if), debug the collection of chart names and verify they appear in same order as those in 'vArr'. Perhaps you could let us know how the German version compares. Regards, Peter T [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Creating charts in non-English versions of Excel
Top