windows file shortcut using vb
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 |
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 |
windows file shortcut using vb
Thanks that helped me a whole lot!
"Bob Phillips" wrote: 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 |
All times are GMT +1. The time now is 08:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com