Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Change Icon of a Shortcut with VBA?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Change Icon of a Shortcut with VBA?

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



  #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



.

  #4   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



.

  #5   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



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Change Icon of a Shortcut with VBA?

Hi Michel,

That last transmisssion shouldn't have been sent. Please
read this one.

Thank you - your response works!

I don't quite understand why or how. I've modified it to:
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: Walt"
.WorkingDirectory = ThisWorkbook.Path
.Save
End With
End With
End Sub

Why doesn't it crash when there's an existing .ico file
with that name (You can run this routine multiple times
with no conflict)? Furthermore, your response did not
address whether it's possible or practical to change or
replace all shortcut icons pointed to the same file. Is
it? You're the master in this area - not me.

Best Regards,
Walt


-----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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a shortcut command or quick access icon for subscript? steve Excel Discussion (Misc queries) 0 November 26th 07 03:40 PM
shortcut icon properties BonnemBK Excel Discussion (Misc queries) 0 June 11th 07 07:01 AM
Is there a shortcut icon for deleting row/columns in the tool bar asalyers Excel Discussion (Misc queries) 6 June 27th 06 08:27 PM
There should be a shortcut icon for "wrap text" Terri@Lear Excel Discussion (Misc queries) 6 April 15th 05 11:50 AM
Running a macro from a desktop icon shortcut Sofia Excel Programming 2 July 15th 03 08:01 PM


All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"