MS Word 2007 macros across languages

J

Judy

I use a Word in English on one partition of a dual boot computer, with
Word in Czech on the other partition. I capture keystroke macros in
both partitions, which I store in a single Normal.dotm which I use in
both languages.

If I record a macro in English it might include "Automatic Table 1"
but this macro fails in Czech, which expects “Automatická tabulka 1”.

Is it possible to tweak such macros by inserting code lines like “If
Language = Czech then … Else If Language = English then…”?
 
P

Per Jessen

Hi

Look for LanguageSettings property in help.

Set objLangSet = Application.LanguageSettings
MsgBox objLangSet.LanguageID(msoLanguageIDInstall)
If objLangSet.LanguageID(msoLanguageIDInstall) =1030 then
' English version
Else
' Czech version
End If

Regards,
Per



"Judy" <[email protected]> skrev i meddelelsen
I use a Word in English on one partition of a dual boot computer, with
Word in Czech on the other partition. I capture keystroke macros in
both partitions, which I store in a single Normal.dotm which I use in
both languages.

If I record a macro in English it might include "Automatic Table 1"
but this macro fails in Czech, which expects “Automatická tabulka 1”.

Is it possible to tweak such macros by inserting code lines like “If
Language = Czech then … Else If Language = English then…”?
 
J

Jay Freedman

Per Jenssen has given you a direct answer to your question, and it
applies to all macros. I just want to comment on something you
mentioned, assuming that by "keystroke macros" you mean macros that
insert text into the document.

The whole idea of capturing keystroke macros is a WordPerfect thing
that is completely unnecessary in Word. Instead, Word provides
AutoCorrect and Building Blocks (including AutoText and other
galleries). AutoCorrect is aware of the language at the insertion
point, so you can have two entries with the same name in both
languages, and the correct one will be inserted depending on the
current language -- even if the same document contains both languages.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
J

Judy

Hi

Look for LanguageSettings property in help.

Set objLangSet = Application.LanguageSettings
MsgBox objLangSet.LanguageID(msoLanguageIDInstall)
If objLangSet.LanguageID(msoLanguageIDInstall) =1030 then
    ' English version
Else
    ' Czech version
End If

Regards,
Per

"Judy" <[email protected]> skrev i meddelelsenI use aWordin English on one partition of a dual boot computer, withWordin Czech on the other partition. I capture keystrokemacrosin
both partitions, which I store in a single Normal.dotm which I use in
bothlanguages.

If I record a macro in English it might include "Automatic Table 1"
but this macro fails in Czech, which expects “Automatická tabulka 1”.

Is it possible to tweak suchmacrosby inserting code lines like “If
Language = Czech then … Else If Language = English then…”?

Can someone please help me further with this? Per’s outline is right
on the spot, but I can’t handle “Look for Language Settings property
in help.” When I do this I get 1-25 of top 100 instead of a tabular
list of languages. Can someone please direct me to a tabular list of
languages, or alternatively give me the correct code for ' English
version and ' Czech version?
 
J

Jay Freedman

Can someone please help me further with this? Per’s outline is right
on the spot, but I can’t handle “Look for Language Settings property
in help.” When I do this I get 1-25 of top 100 instead of a tabular
list of languages. Can someone please direct me to a tabular list of
languages, or alternatively give me the correct code for ' English
version and ' Czech version?

In the VBA editor, press F2 to open the Object Browser. In the search
box (to the left of the 'binoculars' icon), type the word
MsoLanguageID and press Enter. You'll get a list of all the constants
in that enumeration. Click on any one of them and look at the bottom
of the window for the numeric value (or just use the name of the
predefined constant in code).

For example, msoLanguageIDCzech is 1029 decimal (&H405 hex). You can
use either the name or the numeric value.

There are a number of English variants: 1033 for English US, 2057 for
English UK, 4105 for English Canadian, and so forth.
 

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