View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_5_] Jim Thomlinson[_5_] is offline
external usenet poster
 
Posts: 486
Default Use % as variable for user id?

application.username

This line of code retrieves the value from Tools - Options - General tab
- User Name. This value is at the discression of the user. They could change
it to any value that they want. Because of that I personally never use this.

Environ("UserName")
Retrieves the user name that the person logged into their computer with.
This is managed by the operating system and the end user generally speaking
has no control over it. This is handy for validating who is using your
spreadsheet and granting them the appropriate access, among other things. I
use this all of the time, unless I am developing for multiple platforms where
I tend to use the API shown by Gary.
--
HTH...

Jim Thomlinson


"Roger Govier" wrote:

Hi Bob

If one is only interested in the user of the Excel application being
run, are there any merits of
Environ("UserName") over
application.username

I have only ever used the latter, but by chance happened to come across
the use of Environ variables elsewhere whilst researching something
today. I have no idea of the differences.


--
Regards

Roger Govier


"Bob Phillips" wrote in message
...
Just use

Environ("UserName")

to get the network login name.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"R. Choate" wrote in message
...
Can I initialize the % sign as a variable in code to identify and use
to

indicate the user id of the user who is running the code on
their station? For example X = %. or something like that.

Thanks,
--
RMC,CPA