View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Function variables

Hi
and what's your problem. 'nn' contains the Windows user name which you
could check with an added statement like
msgbox nn


--
Regards
Frank Kabel
Frankfurt, Germany

"Todd Huttenstine" schrieb im
Newsbeitrag ...
I cant get this to work. heres what I did...

Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" ( _
ByVal lpBuffer As String, nSize As Long) As Long

Public Sub WindowsUserName()
Dim UName As String * 255
Dim nn
Dim L As Long: L = 255
Dim Res As Long
Res = GetUserName(UName, L)
UName = Left$(UName, L - 1)
nn = Trim(UName)
End Sub



-----Original Message-----
Can't you just run the function again?

If not, save the result as a Module scope variable.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
hey guys I have a function and need to preserve its

value
once the function ends. I need to store this value as a
variable in another module. Is this possible?


Todd Huttenstine



.