Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Steve, that works perfectly.
Fred "Steve Yandl" wrote in message . .. 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're welcome. The object also lets you set WindowStyle, HotKey, and
IconLocation (icon choice) for the shortcut but I've never found any of them important enough to include in routines I write. Steve "Fred" <leavemealone@home wrote in message ... Thanks Steve, that works perfectly. Fred "Steve Yandl" wrote in message . .. 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vista & XP editing web files | Excel Discussion (Misc queries) | |||
EXCEL files locked for editing | Excel Discussion (Misc queries) | |||
Can I use Excel, opening and editing files, online? | Excel Discussion (Misc queries) | |||
KB shortcut to switch between files | New Users to Excel | |||
Importing/Exporting text files and string editing | Excel Programming |