View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default windows file shortcut using vb

Here is some code

Sub CreateShortCut()
Dim oWSH As Object
Dim oShortcut As Object
Dim sPath As String

Set oWSH = CreateObject("WScript.Shell")
sPath = "C:\myFolder"

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

Set oWSH = Nothing

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike C" wrote in message
...
i would like vb to create a shortcut to a file i have and put that

shortcut
into a parent folder. I think that the ShellLink function will work but i
don't know how to do it. Any suggestions? im stumped.
Thanks