HELP for a macro to create a shortcut of an excel file on the desk

F

Francesco

Hello

Using windowsXP Prof. and excel 2003

Is there a way to create a shortcut of an excel file on the Desktop using a
macro?
If yes, can anyone tell me how?
Thanks
Francesco
 
B

Bob Phillips

'----------------------------------------------------------------
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


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
F

Francesco

Thanks a lot Bob it works fine
Regards
Francesco

Bob Phillips said:
'----------------------------------------------------------------
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


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Top