Environ("USERNAME")

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
 
J

Joel

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
 
J

Joel

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.
 
R

Rick Rothstein

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.
 
H

Heera

Thank you Rick your suggesstion was more appropriate......Joel your
trick helped me to increase my knowledge....
 

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

Similar Threads


Top