Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Environ("USERNAME")


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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Environ("USERNAME")

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



"Heera" wrote:


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Environ("USERNAME")

tried it but it says compile error:

can't find project or libary.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Environ("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.




"Heera" wrote:

tried it but it says compile error:

can't find project or libary.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Environ("USERNAME")

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.

--
Rick (MVP - Excel)


"Heera" wrote in message
...
tried it but it says compile error:

can't find project or libary.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Environ("USERNAME")

Thank you Rick your suggesstion was more appropriate......Joel your
trick helped me to increase my knowledge....
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
environ username vs. application username jatman Excel Programming 4 May 28th 09 08:40 AM
"filename is locked for editing by username" srinath Excel Discussion (Misc queries) 1 February 26th 09 11:35 AM
Save active sheet as "filename" on a remote server with username and password Teddy[_3_] Excel Programming 2 May 11th 07 04:48 PM
Environ("username") riso Excel Programming 11 March 9th 07 10:43 AM
Including Environ Username in Cell swieduwi Excel Worksheet Functions 9 March 30th 06 04:43 PM


All times are GMT +1. The time now is 04:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"