This code does as the subject states it will retrieve the short name
of a long file name.
Add a label and command button to your program, cut and paste the
code below.
==================================================================
Option Explicit
Private Declare Function GetShortPathName Lib "KERNEL32" Alias _
"GetShortPathNameA"(ByVal lpszLongPath As String, ByVal lpszShortPath _
As String, ByVal cchBuffer As Long) As Long
Private Const PATH_LEN& = 164
Public Function sGetShortFileName(ByVal FileName As String) As String
Dim lRC As Long
Dim sShortPath As String
sShortPath = String$(PATH_LEN + 1, 0)
lRC = GetShortPathName(FileName, sShortPath, PATH_LEN)
sGetShortFileName = Left$(sShortPath, lRC)
End Function
Private Sub Command1_Click()
'Replace 'c:\program files' with the path/file you want to find
'its short name. The path must be exist on your computer
Label1 = sGetShortFileName("c:\program files")
End Sub