Is it possible to programmatically determine where a user is?

E

Edward

Hi everybody,
I’m writing some VBA code to customize several office programs I know how to
find users login name but I’m not sure that is possible to find the region or
country they are ? If I can find their country then I can apply some default
settings for each region. We have offices in US, Europe and Asia.
Thanks,
 
B

Bob Phillips

Try

application.International(xlcountrysetting)

it will be a code which needs interpreting, for example 44 is GB.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
R

Ron de Bruin

Hi Bob

Yes 1 = US

US Vista with US O 2007

MsgBox Application.International(xlCountryCode) = 1
MsgBox Application.International(xlCountrySetting) = 1

US Win XP with German O2007

MsgBox Application.International(xlCountryCode) = 49
MsgBox Application.International(xlCountrySetting) = 1


So as far as I can test it

xlCountryCode = Excel language version
xlCountrySetting = Windows language version


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


Bob Phillips said:
I get 1 on my system for that Ron, which I assume is the US, so I reckoned
it was the language version?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
R

Ron de Bruin

From Help

xlCountryCode Long Country/Region version of Microsoft Excel.
xlCountrySetting Long Current country/region setting in the Windows Control Panel.


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


Ron de Bruin said:
Hi Bob

Yes 1 = US

US Vista with US O 2007

MsgBox Application.International(xlCountryCode) = 1
MsgBox Application.International(xlCountrySetting) = 1

US Win XP with German O2007

MsgBox Application.International(xlCountryCode) = 49
MsgBox Application.International(xlCountrySetting) = 1


So as far as I can test it

xlCountryCode = Excel language version
xlCountrySetting = Windows language version
 
Joined
Nov 13, 2019
Messages
2
Reaction score
0
Hi,

xlCountryCode = Excel language version
xlCountrySetting = Windows language version

I'm really not sure these codes gives us the language every time, as they are country codes.
The (phone prefix and) xlCountrySetting for Belgium is 32, but there are 3 different languages (Dutch, French and German) in use here.
The same applies for Switserland , with German, French, Italian and Roman.
Wat about Canada with at least 2 official languages and phone prefix 1, the same as the US? What are these codes for French and English in Canada?
The closest I can think of to find out the language is by analysing the xlYearCode, xlMonthCode and xlDayCode.
 

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