Environ("USERNAME")

  • Thread starter Thread starter Heera
  • Start date Start date
H

Heera

Hi all,

I am in tension because this particular code is not working in my
project.

ActiveCell.Value = Environ("USERNAME")

When I compile my project the cursor highlights this code and the
reference book gets open automatically. Please suggest.

Regards
Heera Chavan
 
Break the line up into to line to help find the problem. I think the active
cell is the issue. You may have a workbook that is opening on a chart page
and not a worksheet page which is giving you the problem, the cell is
protected, or you are trying to write to a merge cell and not using the first
cell or the merged group.

UserName = Environ("USERNAME")
ActiveCell.Value = UserName
 
Add a message box to find out what the UserName is set to.


UserName = Environ("USERNAME")
msgbox(UserName)
ActiveCell.Value = UserName


If there is no username being display you have to find out what
envirnomental properties are set in you PC.

From XP
Start - run
type in the run box the following : cmd.exe
A shell window will appear
Type this at the command prompt : Set
Your properties will be seen in this window.


From vista
Start - Search
In the Search box type : CMD
A shell window will appear
Type this at the command prompt : Set
Your properties will be seen in this window.
 
Go into the VB editor and click Tools/References from its menu bar (could
take a few seconds for something to happen, so don't panic if it does)... is
anything marked as "MISSING"? If so, put a check mark in its box, hit OK and
then try your code again.
 
Thank you Rick your suggesstion was more appropriate......Joel your
trick helped me to increase my knowledge....
 
Back
Top