View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Change Display Icon

ben,

If the icon already exits, then the code replaces it.
So change the icon name/path and run the code.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

'-------------------------------
Sub Desktopshortcut()
Dim WSHShell As Object
Dim MyShortcut As Object
Dim DesktopPath As String

Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\macrofun.lnk")
With MyShortcut
.TargetPath = _
"C:\Documents and Settings\user\My Documents\Excel Files\Help Files\macrofun.hlp"
.IconLocation = "F:\Icons\Arrows\ARW03DN.ICO"
.WindowStyle = 1
.Save
End With

Set WSHShell = Nothing
Set MyShortcut = Nothing
MsgBox "A shortcut has been placed on your desktop. ", vbInformation, " Primitive Software"
End Sub
'-------------------------


"ben" (remove this if mailing direct)
wrote in message
Is there a way change the display icon of a shortcut on the desktop either
with vba or an api call?
--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?