View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Steve Yandl Steve Yandl is offline
external usenet poster
 
Posts: 284
Default Editing Shortcut files

The following example using the WScript shell object creates a shortcut to
the workbook the macro is in and sets the 'Start In' (working directory) to
C:\Scripts.

____________________________________________

strWkbkTgt = ThisWorkbook.Path & "\" & ThisWorkbook.Name

Set objWSH = CreateObject("WScript.Shell")
strDesktop = objWSH.SpecialFolders("Desktop")

Set objLink = objWSH.CreateShortcut(strDesktop & "\" & ThisWorkbook.Name &
".lnk")
objLink.TargetPath = strWkbkTgt
objLink.WorkingDirectory = "C:\Scripts"
objLink.Save

______________________________________________

Steve



"Fred" <leavemealone@home wrote in message
...
Does anyone know how I can create and edit a shortcut file in VB.
I am trying to create a shortcut to a workbook and then edit the 'start
in:' field of the shortcut

Thanks
Fred