Hi Brian,
No need to look for right most or left characters to handle the situation, Just checking with an If condition would solve your problem. Below is the code I ve written to suit your requirement.
You can put "/" if you want in the name as you asked F/M/L, in place of space " ". But dont forget to replace that at both the places that is when sending an argument and at split keyword in the function.
Thanks,
Suesh.
No need to look for right most or left characters to handle the situation, Just checking with an If condition would solve your problem. Below is the code I ve written to suit your requirement.
Code:
Function splitNames(str)
splitNames = split(str," ")
End Function
strName = splitNames("Suresh Vasu Kondapally")
IF UBound(strName)<2 Then
MsgBox "First Name :"&strName(0)&", Middle Name : Not Entered"&", Last Name : "&strName(1)
Else
MsgBox "First Name :"&strName(0)&", Middle Name : "&strName(1)&", Last Name : "&strName(2)
End IF
You can put "/" if you want in the name as you asked F/M/L, in place of space " ". But dont forget to replace that at both the places that is when sending an argument and at split keyword in the function.
Thanks,
Suesh.