I have a macro that returns the user's name in this format:"Doe, John". What I want is to be formatted like:"John Doe".
Here is the macro I am working with.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim ws As Worksheet
Set ws = ActiveSheet
With ws.Range("G1")
.Value = Now
.NumberFormat = "ddmmmyy hh:mm"
End With
Set WSHnet = CreateObject("WScript.Network")
UserName = WSHnet.UserName
UserDomain = WSHnet.UserDomain
Set objUser = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
UserFullName = objUser.FullName
ws.Range("H1") = objUser.FullName
End Sub
Here is the macro I am working with.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim ws As Worksheet
Set ws = ActiveSheet
With ws.Range("G1")
.Value = Now
.NumberFormat = "ddmmmyy hh:mm"
End With
Set WSHnet = CreateObject("WScript.Network")
UserName = WSHnet.UserName
UserDomain = WSHnet.UserDomain
Set objUser = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
UserFullName = objUser.FullName
ws.Range("H1") = objUser.FullName
End Sub