ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Display Icon (https://www.excelbanter.com/excel-programming/353199-change-display-icon.html)

ben

Change Display Icon
 
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?

Jim Cone

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?


All times are GMT +1. The time now is 06:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com