codice:
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" _
    (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long

Public Function GetShortPath(strFileName As String) As String
    Dim lngRes As Long
    Dim strPath As String
    
    strPath = String$(255, 0)
    lngRes = GetShortPathName(strFileName, strPath, 254)
    GetShortPath = Left$(strPath, lngRes)
    
End Function
da chiamare così

codice:
veriabilestringa = GetShortPath(percorsofile)
ps: il percorso deve esistere