mrmmickle1
Well-known Member
- Joined
- May 11, 2012
- Messages
- 2,461
I have to get on a call later this afternoon regarding an error that is being produced in a Spanish Version of Excel (Argentina). I am trying to identify why my code is not working beforehand so that I can troubleshoot the issue on the fly. Does anyone have any idea why my code to create slicers would be breaking? I have identified that the break occurs someplace in this region of code. Does anyone see anything that stands out?
I have a feeling the Custom Slicers Style is not being converted from the English Version to Spanish Version.... (Can someone confirm this to be a known Issue?)
My goal is to identify the issue and then create a block of code similar to this:
Or Maybe..... If Not English then.....do X
My company is Global so I may have to take into account several different language types....
I have a feeling the Custom Slicers Style is not being converted from the English Version to Spanish Version.... (Can someone confirm this to be a known Issue?)
Code:
[COLOR=#0000ff] With[/COLOR] ActiveWorkbook.SlicerCaches
[COLOR=#008000] 'Add the slicer[/COLOR]
.Add(pt, strSlicerName).Slicers.Add ActiveSheet, _
, strSlicerName, strSlicerName, 46, intSlicerPos, 160, 136
[COLOR=#008000]
'Code Breaks in this area someplace
'''==================================================================[/COLOR]
ActiveSheet.Shapes(strSlicerName).Placement = xlFreeFloating[COLOR=#008000] 'Anchor Slicer[/COLOR]
[COLOR=#008000] 'Add to Filter In order to make the drill throughs work correctly in the Pivot Table[/COLOR]
[COLOR=#0000ff] With[/COLOR] ActiveSheet.PivotTables("PivotTable1").PivotFields(strSlicerName)
.Orientation = xlPageField
.Position = 1
[COLOR=#0000ff] End With[/COLOR]
[COLOR=#0000ff] With[/COLOR] ActiveWorkbook.SlicerCaches("Slicer_" & Replace(strSlicerName, " ", "_"))[COLOR=#008000] 'Replaces spaces with underscores[/COLOR]
.Slicers(strSlicerName).SlicerCache.CrossFilterType = xlSlicerNoCrossFilter [COLOR=#008000]'Allows items with no data not to appear in slicer[/COLOR]
.Slicers(strSlicerName).SlicerCache.ShowAllItems = False [COLOR=#008000] 'Removes Any Deleted Items[/COLOR]
[COLOR=#0000ff] .Slicers(strSlicerName).Style = "MySlicerStyle 2" 'Style of Slicer[/COLOR][COLOR=#ff0000] <------ My gut says it's this line
[/COLOR][COLOR=#008000]
'''==================================================================[/COLOR]
Code:
[COLOR=#0000ff]Select Case[/COLOR] Application.International(xlCountryCode)
[COLOR=#0000ff]Case[/COLOR] 31: MsgBox "Run code for Dutch"
[COLOR=#0000ff] Case[/COLOR] 7: MsgBox "Run code for Russian"
[COLOR=#0000ff] Case Else[/COLOR]: MsgBox "Run code for English (default)"
[COLOR=#0000ff] End Select[/COLOR]
[COLOR=#0000ff] Select Case[/COLOR] Application.LanguageSettings.LanguageID(msoLanguageIDUI)
[COLOR=#0000ff] Case [/COLOR]1043: MsgBox "Run code for Dutch"
[COLOR=#0000ff] Case [/COLOR]1049: MsgBox "Run code for Russian"
[COLOR=#0000ff] Case Else[/COLOR]: MsgBox "Run code for English (default)"
[COLOR=#0000ff] End Select[/COLOR]
Or Maybe..... If Not English then.....do X
My company is Global so I may have to take into account several different language types....
Last edited: