< Public Function ConvertToSafeText (InText As String) As String (?)

Comments

'--------------------------------------------------------------- 'Removes non-alphabetic characters, eg. converts ' good MORNING everyone to GoodMorningEveryone '---------------------------------------------------------------

Public Function ConvertToSafeText (InText As String) As String

    Dim outText As String
    Dim i As Long
    Dim Char As String
    Dim NextCharCaps As Boolean
    
    If Len(InText) = 0 Then Exit Function
    
    NextCharCaps = True
    For i = 1 To Len(InText)
        
        Char = UCase(Mid(InText, i, 1))
        
        If InStr(Alphabet, Char) > 0 Then
                        
            If Not NextCharCaps Then
                Char = LCase(Char)
            Else
                NextCharCaps = False
            End If
            
            
        Else
            
            If Not InStr("1234567890", Char) > 0 Then
                Char = ""
            End If
            
            NextCharCaps = True
        
        End If
        
        outText = outText & Char
        
    Next
    ConvertToSafeText = outText
End Function


Copying, Return to index