PDA

View Full Version : Solved: creating desktop shortcuts



drawworkhome
12-12-2009, 05:54 PM
:hi: hi all,
could someone inform me of the general steps i would need to take to create a desktop shortcut? i would like to create one when i do a saveas from my workbook. i am using 2007 and 2003 with xp.
thanks for any ideas!
erik

Bob Phillips
12-13-2009, 02:58 AM
Sub CreateShortCut()
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String

Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")

Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
ActiveWorkbook.Name & ".lnk")
With oShortcut
.TargetPath = ActiveWorkbook.FullName
.Save
End With
Set oWSH = Nothing

End Sub

drawworkhome
12-14-2009, 08:27 AM
thank you xld.
erik