Für dieses Beispiel benötigen Sie einen Label und einen CommandButton.
Private Declare Function PathCompactPath Lib "shlwapi" Alias _
"PathCompactPathA" (ByVal hDC As Long, ByVal lpszPath As String, _
ByVal dx As Long) As Long
Private Sub Command1_Click()
Dim newHDC As Long, controlWidth As Long
Dim SampleFile As String
' Nur ein Beispielpfad:
SampleFile = "C:\Programme\VisualBasic\LangerOrdnerName\" & _
"NocheinUnterordner\DasisteineBeispieldatei.txt"
Me.ScaleMode = vbPixels
controlWidth = Label1.Width - Me.DrawWidth
newHDC = Me.hDC
PathCompactPath newHDC, SampleFile, controlWidth
Label1.Caption = SampleFile
End Sub