View Single Post
 
Old 04-07-2021, 01:31 AM
rgros rgros is offline Windows 10 Office 2019
Novice
 
Join Date: Jan 2021
Posts: 8
rgros is on a distinguished road
Default install language and macro language

I have a inhereted a macro that inserts a table if it is needed and checks after doing so if the table style is OK.
It fails sometimes, namely when the table is inserted. It appears that an error is raised on these lines:
Code:
        With Selection.Tables(1)
            If .style <> "Tabelraster" Then
                .style = "Tabelraster"
            End If
        End With
This used to work, but somehow the word install now is an english install, it used to be a dutch install, in which the style name for 'Table Grid' is 'Tabelraster'. The english install raises an error "Can't apply style"; changing 'Tabelraster' to 'Table Grid' in the macro makes it work again.
I need to fix this situation and I want to understand what option I have to repair this.
  • is a dutch install absolutely needed when the style names are dutch?
  • can the macro detect the language of the install and behave accordingly?
  • is there a way to write the macro in a way that is install language independant?
  • do I need to scan all macro files for dutch style names and translate them to english?
thanks for any insights about this!


Ruud

I have changed the above code to
Code:
        With Selection.Tables(1)
            Dim insLan
            insLan = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
            If .style <> "Tabelraster" And .style <> "Table Grid" Then
                If (insLan = 1033) Then
                    ' English
                    .style = "Table Grid"
                else
                    ' Dutch
                    .style = "Tabelraster"
                End If
            End If
        End With
...which seems to work, but it feels lik the wrong way to go. What would be the best practice?
Reply With Quote