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 Make a shortcut to a file - code

Hi Jim

This example will place a shortcut to the activeworkbook on the desktop
Change DesktopPath to your folder


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


"Jim" wrote in message ...
I want to make a shortcut to a file and place it in another folder. The name
of the file will be something like "shortcut to myfile.xls"