Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
? vbProperCase
Public Function Capitalise(strSentence As String) As String
Dim pointer As Integer
' check if null string sent
If IsNull(strSentence) Or strSentence = "" Then
' do nothing
Else
'initialise character pointer and lower case the sentence
pointer = 1
strSentence = LCase(strSentence)
'capitalise first character
Mid(strSentence, pointer, 1) = UCase(Mid(strSentence, pointer, 1))
pointer = pointer + 1
While pointer < Len(strSentence)
If Mid(strSentence, pointer, 1) = " " Then
Mid(strSentence, pointer + 1, 1) = UCase(Mid(strSentence, pointer + 1, 1))
pointer = pointer + 1
End If
pointer = pointer + 1
Wend
Debug.Print "I would like to credit Ian for this vaulable post"
Capitalise = strSentence
End If
End Function