View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Change Icon of a Shortcut with VBA?

Sub MakeShortcut()
With CreateObject("WScript.Shell")
With _
.CreateShortcut(.SpecialFolders("Desktop")
& "\MRS.lnk")
.TargetPath = ThisWorkbook.Path & "\" &
ThisWorkbook.Name
.WindowStyle = 1
.Hotkey = ""
.IconLocation = ThisWorkbook.Path
& "\Icon.ico, 0"
.Description = "by: Spreadsheet Design &
Automation Co."
.WorkingDirectory = ThisWorkbook.Path
.Save
End With
End With
End Sub



-----Original Message-----
Hi Walt;
You can recreate it by changing the name of the file

icon; one example:

With CreateObject("WScript.Shell")
With .CreateShortcut(.SpecialFolders("Desktop")

& "\Gpao.lnk")
.TargetPath = ThisWorkbook.Path & "\Gpao.vbe"
.WindowStyle = 1
.Hotkey = "CTRL+SHIFT+G"
.IconLocation = ThisWorkbook.Path & "\Gpao.ico, 0"
.Description = "Session GPAO"
.WorkingDirectory = ThisWorkbook.Path
.Save
End With
End With

MP

"Walt Weber" a écrit dans le message de
...
Hi To All,

Is it possible to change the icon of a desktop shortcut
using VBA? And also using VBA, can you search for and
identify the shortcut to change using it's target path?

Any help appreciated.

Walt



.