Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Const MAX_PATH_LENGHT = 255
Function ShortPath(LongPath As String) As String
Dim tmpShortPath As String
Dim RC As Long
tmpShortPath = Space(MAX_PATH_LENGHT + 1)
RC = GetShortPathName(LongPath, tmpShortPath, MAX_PATH_LENGHT + 1)
ShortPath = Left(tmpShortPath, InStr(tmpShortPath, Chr$(0)) - 1)
End Function
Private Sub Test()
MsgBox ShortPath(" C:\Projets\Samples\NewStepperLuxe\Lib\AMORTISSEUR COMPLET.top.png")
End Sub