#1
|
|||
|
|||
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 I need to fix this situation and I want to understand what option I have to repair 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 |
#2
|
||||
|
||||
How about
Code:
With Selection.Tables(1) On Error Resume Next .Style = "Tabelraster" If Err Then .Style = "Table Grid" End If On Error GoTo 0 End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
||||
|
||||
How about:
Code:
Sub TblFmt() Selection.Tables(1).Style = -155 End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
that sounds promising. Not depending on the installed language. Where can I read more about assigning numeric values to a style? I obviously use the wrong search terms to find a list of style codes.
thanks, Ruud |
#5
|
||||
|
||||
See attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Also helpful may be Lene Fredborg's macro to create a list of local names.
Create List of Local Built-in Style Names It gives the value as well as the local name. (I see this is also linked in the pdf that Paul provided.) |
#7
|
|||
|
|||
Thank you all for your reactions. I'm convinced that with your suggestions I will succeed in making the macro's able to cope with both english and dutch installs. Great forum!
Ruud Indeed the posted list of styles and the macro that Charles posted helped me out. I cannot find a way to mark this as solved, but solved it is. Last edited by rgros; 04-08-2021 at 06:19 AM. |
Tags |
language, style language |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Having Difficulty Changing the Default Language and Spell Check Language | JimG35 | PowerPoint | 0 | 10-30-2020 04:41 PM |
installation of a language pack in Greek language for MS office 2016 professional plus/prob | alsw | Office | 3 | 02-26-2018 08:49 PM |
Macro to change language and untick 'do not check spelling' | William E | PowerPoint | 2 | 05-13-2017 01:47 PM |
Word macro - remove shading from active para. and assign language to it, keep text cursor position | dejanm83 | Word VBA | 3 | 03-19-2017 02:36 PM |
install new interface language | shmu | Office | 4 | 09-21-2014 02:43 AM |