Does anyone have any tips or links to information about localizing my VBA
code? So far it's been running in North America and Australia, where some
form of English can be selected from the Regional Options, and where an
English keyboard is in use.

Now I'm going into Spain, and aside from a different keyboard layout, some
macros seem to stumble. Here's the most common error message:

The Find What text contains a Pattern Match expression which is not valid.

I'm also wondering how I should handle the different delimiters used in
numbers (decimals vs. commas). Date formats aren't a big problem yet.

Can I detect the language settings in VBA?

Bear

--
Windows XP, Word 2000

Re: Localize my VBA? by Karl

Karl
Thu Apr 10 12:11:13 PDT 2008

Bear wrote:
> Can I detect the language settings in VBA?

In addition to whatever rudimentary offerings Word's object model may offer, you can
determine just about any aspect of the language settings using the code here:
http://vb.mvps.org/samples/Locale
--
.NET: It's About Trust!
http://vfred.mvps.org



Re: Localize my VBA? by Doug

Doug
Thu Apr 10 13:04:52 PDT 2008

That problem is most likely caused by the need to replace commas with
semi-colons in some instances, where the comma is acting as a list
separator.

In the Control Panel>Regional and Language Options, if you click on the
Customize button on the Regional Options tab, you can change the list
separator back to a comma. Of course, that will only be good for the
machine on which you change it and won't help if you are distributing the
code to other users.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Bear" <david.chinell@ge.com(nospam)> wrote in message
news:13C8FF34-D538-48F5-869D-FF1B8BDE5CFC@microsoft.com...
> Does anyone have any tips or links to information about localizing my VBA
> code? So far it's been running in North America and Australia, where some
> form of English can be selected from the Regional Options, and where an
> English keyboard is in use.
>
> Now I'm going into Spain, and aside from a different keyboard layout, some
> macros seem to stumble. Here's the most common error message:
>
> The Find What text contains a Pattern Match expression which is not valid.
>
> I'm also wondering how I should handle the different delimiters used in
> numbers (decimals vs. commas). Date formats aren't a big problem yet.
>
> Can I detect the language settings in VBA?
>
> Bear
>
> --
> Windows XP, Word 2000



RE: Localize my VBA? by david

david
Thu Apr 10 13:19:01 PDT 2008

Okay, I found that particular problem. It was the Spanish list delimiter. For
some reason the Range.Find function is sensitive to the list delimiter. The
code

.Text = "[0-9]{1;2}.^t

works because I use ";" as a list separator rather than ","

I can also determine the application.international(wdListSeparator) and use
that in an If structure to offer two different Range.Find statements.

But there must be more information on preparing code for international use.

Any suggestions?

--
Windows XP, Word 2000



Re: Localize my VBA? by david

david
Thu Apr 10 13:19:03 PDT 2008

Karl:

Thanks for that link. I've checked out all your offerings at that site and
bookmarked the page for future downloading. Thanks for sharing!

Bear

--
Windows XP, Word 2000



Re: Localize my VBA? by david

david
Thu Apr 10 14:35:00 PDT 2008

Karl:

Maybe I'm dismissing your tool too quickly. Do you think it would be a
reasonable approach to switch the language into and back out of English each
time the user invokes one of my subroutines?

Or would it be better just to adjust each subroutine to handle the language
settings it encounters?

Bear

--
Windows XP, Word 2000



Re: Localize my VBA? by Karl

Karl
Thu Apr 10 15:05:17 PDT 2008

Bear wrote:
> Maybe I'm dismissing your tool too quickly. Do you think it would be a
> reasonable approach to switch the language into and back out of English each
> time the user invokes one of my subroutines?
>
> Or would it be better just to adjust each subroutine to handle the language
> settings it encounters?

The latter! Switching languages should never be done without user initiation.
--
.NET: It's About Trust!
http://vfred.mvps.org