Chemin associé à un raccourci

Peut-on lister les chemins complets + noms de fichiers à partir d'une liste de raccourcis (Raccourci.lnk) dans un repertoire ?

Avec Shell.Application, pour récupérer les raccourcis du bureau.

sub RecupShortCutsurBureau()
  Dim ObjShell, ObjFolder
  Set ObjShell = CreateObject("Shell.Application")
  For Each ObjFolder In ObjShell.NameSpace(0).Items
    If ObjFolder.IsLink Then
      MsgBox ObjFolder.Path & vbNewLine & ObjFolder.GetLink.Path
    End If
  Next
  Set ObjFolder = Nothing
  Set ObjShell = Nothing
 end sub

Une autre approche possible :

sub test()
 Dim sLnk$
 sLnk = "C:\Documents and Settings\FS\Menu Démarrer" & _
   "Programmes\Accessoires\Bloc-notes.lnk"
 MsgBox CreateObject("WScript.Shell").CreateShortcut(sLnk).TargetPath
 end sub

Auteurs : ,

Mots clefs associés à cette page : , ,