LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Environ function.

You can also set or add to environment variables using

Private Declare Function SetEnvironmentVariable Lib "kernel32" _
Alias "SetEnvironmentVariableA" _
(ByVal lpName As String, _
ByVal lpValue As String) As Long

SetEnvironmentVariable "Rob", "Nuzie2!"

Unfortunately, Environ gets the values when Excelk started, so it won't know
of these values.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DaveO" wrote in message
...
Thanks Tom, got the idea now mate, thanks.


"Tom Ogilvy" wrote:

Environ is a function, so it has not properties and methods

You can do this to see what is available

Sub AA()
i = 1
Do While Environ(i) < ""
Debug.Print Environ(i)
i = i + 1
Loop
End Sub

this produces output like

TEMP=C:\DOCUME~1\OgilvyTW\LOCALS~1\Temp
TMP=C:\DOCUME~1\OgilvyTW\LOCALS~1\Temp
USERDOMAIN=XXXX
USERNAME=OgilvyTW
USERPROFILE=C:\Documents and Settings\OgilvyTW

so now I see I can get the username by doing

msgbox environ("Username")

--
Regards,
Tom Ogilvy




"DaveO" wrote in message
...
Looking for some help on Environ.

Need to know more about the methods and properties it has so I can see

what
I can do.

Ultimately (at this early stage) trying to get the logged on username

of
the
current user for validation purposes.

Any ideas??






 
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
Including Environ Username in Cell swieduwi Excel Worksheet Functions 9 March 30th 06 04:43 PM
Environ Function Brent Bowen Excel Programming 1 October 7th 04 04:58 PM
Environ() Jan Kronsell[_3_] Excel Programming 5 February 29th 04 09:49 AM
Environ()- help DJ Excel Programming 2 November 13th 03 06:26 AM
Have a list of Environ variables? Scott Warren Excel Programming 2 September 15th 03 06:08 PM


All times are GMT +1. The time now is 10:54 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"