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

Private Sub Command1_Click()
Dim NomeOrig As String
Dim NomeCorto As String
Dim Buffer As Long

NomeOrig = "C:\NomeLungo.txt"
'Crea il file se non esiste
Open NomeOrig For Append As #1
Close #1

Buffer = Len(NomeOrig)
NomeCorto = String(Buffer, 0)
GetShortPathName NomeOrig, NomeCorto, Buffer
MsgBox Left(NomeCorto, Len(NomeCorto))
End Sub