'********************************************************************************************************** ' Name: removeSpaces ' Author: mielk | 2012-11-18 ' ' Comment: Function to remove all the blank characters from the given string. ' ' Parameters: ' text String to be cleaned of blank characters. ' The given value must be of a String type or of any other type that can be ' converted to String. ' The following characters are considered by this function as blank: ' ' Character | ASCII code ' ------------------------|-------------- ' Horizontal Tab | 9 ' Line Feed | 10 ' Carriage Return | 13 ' Space | 32 ' No-Break Space | 160 ' ' Returns: ' String The original text cleaned of blank characters. ' ' ' --- Changes log ----------------------------------------------------------------------------------------- ' 2012-11-18 mielk Function created. '********************************************************************************************************** Public Function removeSpaces(ByVal text As String) As String Const METHOD_NAME As String = "removeSpaces" '------------------------------------------------------------------------------------------------------ removeSpaces = VBA.Replace(text, VBA.Chr$(9), "") '..........................tab removeSpaces = VBA.Replace(removeSpaces, VBA.Chr$(10), "") '.................... linefeed removeSpaces = VBA.Replace(removeSpaces, VBA.Chr$(13), "") '.................... carriage removeSpaces = VBA.Replace(removeSpaces, VBA.Chr$(32), "") '....................... space removeSpaces = VBA.Replace(removeSpaces, VBA.Chr$(160), "") '....................... space End Function