Il me semble qu'il y a une API pour ca ...
ha ca y est, j'ai trouvé : GetShortFileName ...
voila : (dans un module) :
Private Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) _
As Long
Public Function GetShortFileName(ByVal FullPath As String) _
As String
'PURPOSE: Returns DOS File Name (8.3 Format) Give
'FullPath for long file name
'PARAMETERS: FullPath: Full Path of Original File
'RETURNS: 8.3 FileName, or "" if FullPath doesn't
' exist or file fails for other reasons
'EXAMPLE:
'Debug.Print _
' GetShortFileName("C:\My Documents\My Very Long File Name.doc" )
'If file exists, will display C:\MYDOCU~1\MYVERY~1.DOC
'in the debug window
Dim lAns As Long
Dim sAns As String
Dim iLen As Integer
On Error Resume Next
'this function doesn't work if the file doesn't exist
If Dir(FullPath) = "" Then Exit Function
sAns = Space(255)
lAns = GetShortPathName(FullPath, sAns, 255)
GetShortFileName = Left(sAns, lAns)
End Function
et donc NomCourt = GetShortFileName(NomLong)
---------------
FAQ fclc++ - FAQ C++ - C++ FAQ Lite