+ Reply to Thread
Results 1 to 5 of 5

Shortcuts on Desktop/Favorites

  1. #1
    Registered User
    Join Date
    10-11-2004
    Posts
    18

    Cool Shortcuts on Desktop/Favorites

    Hi All,

    I've got lots of shortcuts on my desktop and in favorites. How can I with VBA get those shortcuts info into my excel sheet?

    Description shortcut (example "Excel Files")
    Location folder (example "C:\Excel\")

    Please help

    Lenny

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Lenny_821,

    The shortcut is a special system file known as Link File. It has a .lnk extension but the system hides it from view. There are no VBA properties, methods, or events that are asscoicated with this file type. It would be possible to decode it using API calls. However, the complexity incurred would outweigh it's usefulness.

    Sorry I didn't have better news,
    Leith Ross
    Last edited by Leith Ross; 03-31-2005 at 05:28 PM.

  3. #3
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Lenny_821 , Hello Leith

    for the DeskTop links , you may try


    Sub informationsRaccourcisBureau()
    '
    'activate Microsoft Shell Controls and Automation reference
    'activate Microsoft Scripting Runtime reference
    '
    'test with excel2002 & WinXp
    '
    Const Cible = &H10 'Desktop
    'Const Cible = &H6 'Favorites
    '
    Dim objShell As Shell32.Shell
    Dim objFolder As Shell32.Folder
    Dim colItems As Shell32.FolderItems
    Dim objItem As Shell32.FolderItem
    Dim i As Integer
    Dim Fso As Scripting.FileSystemObject
    Dim FileItem As Scripting.File

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.NameSpace(Cible)
    Set colItems = objFolder.Items
    Set Fso = CreateObject("Scripting.FileSystemObject")

    For Each objItem In colItems
    If objItem.IsLink Then
    i = i + 1
    Cells(i, 1) = objItem.Path
    Cells(i, 2) = objItem.GetLink.Path
    Cells(i, 3) = objFolder.GetDetailsOf(objItem, 14)

    If Fso.FileExists(objItem.GetLink.Path) Then
    Set FileItem = Fso.GetFile(objItem.GetLink.Path)
    Cells(i, 4) = FileItem.Type
    End If

    End If
    Next
    End Sub



    I hope this help you

    Regards ,
    michel
    Last edited by michelxld; 04-01-2005 at 03:35 PM.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Michelxld,

    Thank you for showing me something new. My apologies to Lenny for saying it was not worth the time. It is always good to learn something new.

    Thanks again for code,
    Leith Ross

  5. #5
    Registered User
    Join Date
    10-11-2004
    Posts
    18
    Hi michelxld,

    Thanks for the code. I almost gave up hope.

    Many many thanks

    Lenny

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1