I've written this function to delete blanks from the start and the end of a string, any ideas why it isn't working?
Public Function PrepareString(TextLine As String)
    Do While Left(TextLine, 1) = " " ' Delete any excess spaces
        TextLine = Right(TextLine, Len(TextLine) - 1)
    Loop
    Do While Right(TextLine, 1) = " " ' Delete any excess spaces
        TextLine = Left(TextLine, Len(TextLine) - 1)
    Loop
    PrepareString = TextLine
End Function
 
     
     
    