Localize my VBA?

B

Bear

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
 
D

Doug Robbins - Word MVP

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
 
B

Bear

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?
 
B

Bear

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
 
B

Bear

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
 
K

Karl E. Peterson

Bear said:
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.
 

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