LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default Username

Thanks for all the help. I went ahead with the Application .username even
thou once in a while a user will use another computer and get the wrong name.

"Peter T" wrote:

I did try earlier to suggest the OP check for any missing references and how
to overcome (even how to get Environ to work with a missing ref). The OP's
stated error message was indeed indicative of a missing ref.

However, Environ("Username") does not work in all systems, it's flaky. It
doesn't work in mine, doesn't fail but merely returns an empty string.

The API is more reliable, subject not declaring it as Public in anything but
a normal module (which is what "Declare" defaults to when not preceded with
"Private").

Regards,
Peter T

"Tom Hutchins" wrote in message
...
Clearly, there is no problem with the code. It must be an environmental
(system) problem, Excel has become corrupted, or there is a conflict with
another program.

First, I would double-check the references in the VBE on the computers

that
won't run the Environ("username") statement. Maybe, for example, your
workbook was saved with a reference to the Excel 11.0 Object Library but
those machines only have the Excel 10.0 Object Library.

Second, I would check what add-ins, if any, are enabled on those machines.
Some add-ins (like Hyperion's SmartView) can alter or disable normal Excel
functions. Disable any add-ins not found on the machines that work, and

see
if Environ("username") works then.

Hutch

"Oldjay" wrote:

I can open a new workbook paste the code and get Lan ID
When I insert a new module in the existing workbook and paste the code I

get
the same error. It's got to be something in this machine as the program

works
with Environ("username") on other machines. This a 3.5M estimating

program
with many menus and modules and more than 75 Subs.

Is there any other thing that I can look for?

"Tom Hutchins" wrote:

For me,

?Environ(49) displays nothing
?Environ("username") displays my LAN ID

Hutch

"timmg" wrote:

What does

?Environ(49)

or

?Environ("username")

display when entered directly in the immediate window? (ctrl + G)

tim





 
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
(username v1) JJernigan Excel Discussion (Misc queries) 0 June 12th 08 09:13 PM
username robzrob Excel Worksheet Functions 2 May 4th 08 05:59 PM
userName Ronbo Excel Programming 6 September 26th 05 03:19 PM
UserName rjamison Excel Programming 0 June 14th 05 12:14 AM
UserName Myriam Excel Programming 12 April 20th 05 08:18 PM


All times are GMT +1. The time now is 05:59 AM.

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"