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
Thanks, got this to work. Didnt origionally plan on making the active
workbook the file for the source but it actually turned out to work better.
thanks again everyone.
ok, part 2: what if I want the code to create a shortcut to a folder? I cant
use the active workbook name, SO, would i just set the target path =
c:\thepathIWant??? And would the extention still be .ink for MyShortcut?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.