View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default Returning User Initials

Kelly,

Here's some code to get the initials.
They'll be stored as a Public variable named "UNInit"

Option Explicit
Public UNInit As String
Sub GetInit()
' This procedure will get the initials of the user from
' the Application.UserName
' 1st test is to see if there is an Application.UserName
' This is probably unnecessary as I don't think that Excel
' will let you install Excel without some kind of a User Name
If Application.UserName = "" Then
UNInit = "unk"
Exit Sub
End If
' Find out where the space is
Dim SPacePosit As Integer
SPacePosit = InStr(1, Application.UserName, " ", 1)
If SPacePosit = 0 Then
' There are no spaces. Just get the left character of the first name

UNInit = Left(Application.UserName, 1)
Else
' There's at least one space. Get the left character of the first
name
' along with the first character after the space
UNInit = Left(Application.UserName, 1) & _
Mid(Application.UserName, SPacePosit + 1, 1)
End If
End Sub

In "Word" it is entered in tools/Options/UserInformation

In Excel it's under Tools/Options/General "User Name"

John

Kelly wrote:

Hi all, I am using the Office 2000 package

In Word VB you can return user initials
with "Application.UserInitials"

Is there any way to do this in Excel?

I know you can return user name
with "Application.UserName" but no luck with initials so
far.

Also Where does the user name info come from anyway?
In "Word" it is entered in tools/Options/UserInformation
but I have no idea for Excel.

Thanks as always!

Kelly