Is it possible to create a shortcut with VBA that is placed on the
desctop with a custom icon (shortcut point to an .XLS file)? If so,
how can this be done.
Thanks
Ludo
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 & "\" &
ActiveWorkbook.Name & ".lnk")
With MyShortcut
.TargetPath = ActiveWorkbook.FullName
.Save
End With
Set WSHShell = Nothing
MsgBox "A shortcut has been placed on your desktop."
End Sub
--
Regards
William
willw...@yahoo.com
"Ludo Soete" <bart.l...@barco.com> wrote in message
news:33cb9434.02071...@posting.google.com...
Where can i get some more information abouth this subject?
Thanks a lot.
Ludo
There's some code on my site at
http://www.rb-ad.dircon.co.uk/rob/excelvba/develop/index.htm
Be aware that MS has broken binary compatibility for the Windows Script
Host, so the code may not work on your version of Windows. The solution is
to get rid of the reference to the WSH, change all WSH object declarations
to type generic Object, and then create the WSH instance as William did:
Set WSHShell = CreateObject("WScript.Shell")
...rather that by using the New keyword.
HTH
--
Rob
Excel VBA Programming Stuff:
www.analytical-dynamics.co.uk/
Please keep conversations in the newsgroup so that all may contribute and
benefit.