Environ("Username") with Windows7 64bit

J

Jamen Lone

Hi all,

I'm using XL2003 vba with WIN7 professional and my old vba code won't work.

i create in XP some code lines to read out the user which is log on.
now i want to do the same with win7 prof 64bit
can someone give me hints ??

thanks in advance
 
J

joel

I haven't usered windows 7 but you need to check the envirnomenta
variables on you PC to see what they are set to. You are able to d
this in XP and Vista by running cmd.exe. Not sure if cmd.exe stil
exists in windows 7 since microsoft eliminated lots of 16 and 32 bi
programs in windows 7. cmd.exe in a classic DOS shell that dates bac
to the early 1980's. the first DOS PC had command.com which was th
window which would open up on these old machines. Then command.com wa
replaced with cmd.exe. then the DOS shells were replaced with window
3.0/3.1 (the windows versions less than 3 weren't widely used) an
Window 95.

IN XP it was simple to run cmd.exe you simply went to the menu Start
run and typed cmd.exe. In vista microsoft made it more difficult an
you had to do a search by typing Start - Search and in the search bo
type cmd.exe. Cmd.exe was really in the windows/system32 folder an
could simply go to the folder with a windows explorer and double clic
on the ICON.


If you find cmd.exe then simply type in the DOS window "SET" at th
prompt and you will see all the environmental variables
 
P

Per Jessen

Hi

I am using WIN7 Home Premium 64 bit and XL2007.

In the Immediate window I entered the statement:

debug.Print environ("Username")

and it prompted my username as expected, so I guess you have to look
somewhere else to solve the problem.

Post your code for further comments, along with an error description and
state the line which is highlighted when you click debug.

Regards,
Per
 
G

Gary Keramidas

works fine in any combination of the following for me:
windows 7 ultimate x64
windows 7 pro x64
excel 2003
excel 2007
excel 2010
 
J

Jamen Lone

Thanks .. problem is solved by changing the environmental variables :)


Am 13.02.2010 10:15, schrieb Jamen Lone:
 
C

Chip Pearson

Debug.Print Environ("username")

works fine for me on Windows 7 Ultimate 64-bit, in both XL2003 and
XL2007.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
 
Top