Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Update fields?

Hi,

I wrote a function to get the current user's name:

' Get current user's name
Public Function GetUser() As String
GetUser = Environ("UserName")
End Function

It works fine on my computer, but other users say they had to double-click
on the fields to make its content being updated.
How can this be done within a macro?

Thanks,
Cannabibal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Update fields?

Have you tried:
GetUser=Application.Username

"Cannabibal" wrote:

Hi,

I wrote a function to get the current user's name:

' Get current user's name
Public Function GetUser() As String
GetUser = Environ("UserName")
End Function

It works fine on my computer, but other users say they had to double-click
on the fields to make its content being updated.
How can this be done within a macro?

Thanks,
Cannabibal

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Update fields?

Here iks an API way ro get the login name

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


Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function


The worksheet cell could then use


=UserName()


--

HTH

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


"gocush" wrote in message
...
Have you tried:
GetUser=Application.Username

"Cannabibal" wrote:

Hi,

I wrote a function to get the current user's name:

' Get current user's name
Public Function GetUser() As String
GetUser = Environ("UserName")
End Function

It works fine on my computer, but other users say they had to

double-click
on the fields to make its content being updated.
How can this be done within a macro?

Thanks,
Cannabibal



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
fields names do not show in excel 2007 pivot table fields list marlo17 New Users to Excel 2 December 1st 08 01:25 PM
Keep data in fields if no update while updating MS Excel Worksheet Functions 2 August 28th 08 08:06 AM
[pivottables] multiple table selection fields update in one click... [email protected] Excel Discussion (Misc queries) 1 September 22nd 06 02:42 AM
Why don't fields update automatically when new numbers are input?. Frustrated in NJ Excel Discussion (Misc queries) 2 February 25th 05 03:07 PM
Update fields with blanks kash Excel Discussion (Misc queries) 1 December 3rd 04 09:18 PM


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

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

About Us

"It's about Microsoft Excel"