Hello:This is my first post on this site. So forgive me if this has already been explained and I would ask for help to locate that post.
Basically (and to try and be less verbose as I usually am), I am working on a project for my employer where I am designing an "interview" process that will populate fields on various worksheets in an Excel workbook. I don't want the end user to see the workbook at all to avoid risking the integrity of the formulas within the worksheets.
To start off the interview process (where users will be guided through a series of user forms where they will enter date that populates respective cells in the workbook's worksheets), I have a splash page welcoming the user. I
am trying to make it as inviting as I can, so I began the code with the following:
Private Sub userform_activate()
Application.OnTime Now + TimeValue("00.00.04"), "CloseForm"
lblWelcome.Caption = "Welcome"
lblStarted.Caption = "Let's Get Started"
End Sub
I want to add another label that will take the name of the individual user who is going through the interview process (Application.Username), but trim the string to only show the first name. The problem is, in my organization, a person's name (in any MS Office application) is structured as follows:last name, first name (space) location
How would I dissect the username to just show the first name?
I created this function to clear the last name but am at a loss for how to clear the trailing text after the first name.
Function clearLast(fullname As String) As String
Dim spacePos As IntegerspacePos = InStr(fullname, ", ")
clearLast = Mid$(fullname, spacePos + 1, Len(clearLast) - spacePos)
End Function
Any help would be greatly appreciated.
- Matt
Basically (and to try and be less verbose as I usually am), I am working on a project for my employer where I am designing an "interview" process that will populate fields on various worksheets in an Excel workbook. I don't want the end user to see the workbook at all to avoid risking the integrity of the formulas within the worksheets.
To start off the interview process (where users will be guided through a series of user forms where they will enter date that populates respective cells in the workbook's worksheets), I have a splash page welcoming the user. I
am trying to make it as inviting as I can, so I began the code with the following:
Private Sub userform_activate()
Application.OnTime Now + TimeValue("00.00.04"), "CloseForm"
lblWelcome.Caption = "Welcome"
lblStarted.Caption = "Let's Get Started"
End Sub
I want to add another label that will take the name of the individual user who is going through the interview process (Application.Username), but trim the string to only show the first name. The problem is, in my organization, a person's name (in any MS Office application) is structured as follows:last name, first name (space) location
How would I dissect the username to just show the first name?
I created this function to clear the last name but am at a loss for how to clear the trailing text after the first name.
Function clearLast(fullname As String) As String
Dim spacePos As IntegerspacePos = InStr(fullname, ", ")
clearLast = Mid$(fullname, spacePos + 1, Len(clearLast) - spacePos)
End Function
Any help would be greatly appreciated.
- Matt
Last edited: