ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   icon problem (https://www.excelbanter.com/excel-programming/340796-icon-problem.html)

Tempy

icon problem
 
Good day, i got some code from Bob Phillips, to create an icon and added
in iconlocation from his suggestion which works 100%.
I want to send all the users an excel file with the code in and when
they open it, it will create folders and save the file in there. I then
create a short cut and then want to assign a different icon to it.
I am not sure how to do last portion, should i insert the icon on the
spread sheet so that it can save it also to the folder ?


----------------------------------------------------------------
Sub CreateShortCut()
'----------------------------------------------------------------
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String

Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")

Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
ActiveWorkbook.Name & ".lnk")
With oShortcut
.TargetPath = ActiveWorkbook.FullName
.IconLocation "C:\icons\test.ico"
.Save
End With
Set oWSH = Nothing

End Sub



Tempy

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 01:21 AM.

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