If you Automate Excel from a remote client using Visual
C++, you need to be sure that the LCID for the call is specifically known by
Excel.
Most Excel functions take an LCID parameter when early
binding. If late binding, the LCID passed to IDispatch::Invoke is used as the
LCID parameter for the function being called. If you do not explicitly set the
LCID to a valid value, Excel assumes the system default.
For example,
if you are developing on a system with an English (United States) operating
system and you want the Excel currency setting to show DM for German currency,
but you ignore the Locale ID, then Excel formats the result with the dollar
sign ($) instead of the German currency (DM). Excel does this even if German
has been set under the
Regional Settings in
Control Panel. This is because an LCID of zero is assumed to be the default
locale for the system and not a user. Since the system is English (United
States), in this example, the currency is displayed in U.S. Dollars.
This can be a problem if the Automation program uses the MFC COleDispatchDriver
wrapper classes, because they do not natively support passing a custom LCID.
Instead, MFC always passes LOCAL_SYSTEM_DEFAULT as the LCID in its InvokeHelper
function. If you need to invoke an Excel Automation function with an explicit
LCID, you cannot use InvokeHelper function in MFC, and should instead call
IDispatch::Invoke directly.
You will find a table of the numeric
values for various locale IDs in the Platform SDK on MSDN.
Search for
"Language Identifier" (use the quotes), then scroll to select the topic
Language Identifiers - International Features (without the quotes.) You can also find information about it in
the WINNT.H, the OLENLS.H and/or the WINNLS.H files.