You can't just remove the spaces from a filename can you?
You can however put quotation marks around the name or you could use the GetShortPathName API function:
Code:Private Declare Function GetShortPathName _ Lib "kernel32" Alias "GetShortPathNameA" ( _ ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, _ ByVal cchBuffer As Long) As Long Public Function GetShortName(ByVal LongName As String) As String Dim sShortName As String sShortName = Space$(Len(LongName) + 1) GetShortPathName LongName, sShortName, Len(sShortName) GetShortName = Left$(sShortName, InStr(sShortName, vbNullChar) - 1) End Function




Reply With Quote