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
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
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.
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.
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
Hi michelxld,
Thanks for the code. I almost gave up hope.
Many many thanks
Lenny
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks