This will remove all CRLFs in your line.
strFileName = Replace(strFileName, vbNewLine, "")
Here is the function you can put in the helper module:
Public Function CleanFilePath(FilePath As String) As String Return Replace(FilePath, vbNewLine, "") End Function
EDIT:
Alternatively, an auxiliary routine is used to modify the string itself. However, this is not standard practice in newer languages.
Public Sub CleanFilePath(ByRef FilePath As String) FilePath = Replace(FilePath, vbNewLine, "") End Sub
source share