View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Add shortcut icon to a users desktop?

Hi XP

You can find code here to find the path of the desktop
http://www.rondebruin.nl/folder.htm#SpecialFolders


To create a shortcut to the activeworkbook try

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 Ron de Bruin
http://www.rondebruin.nl/tips.htm


"XP" wrote in message ...
Using Office 2003 and Windows XP.

Is it possible to copy a file to a user's desktop folder and then add a
shortcut icon to the file to that user's desktop?

If so, could someone please post example VBA code to do this? It would solve
my deployment issues for a program...