Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
need command
Is there a way to create a desktop shortcut to an Excel file programmically in VBA? If so could you direct me to the code snippet that accomplishes it
----- Dave Peterson wrote: ---- start "C:\my documents\excel\book1.xls And put your prerecorded macro in a general module and name it Auto_Open You could also just create a shortcut to your workbook (on your desktop???) an then start that, too MS-DOS wrote Is there a command I can use to launch excel from DOS and also have it go right into a pre-recorded macro thanks -- Dave Peterso |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
need command
From a previous post:
If you rightclick on the filename when you're in Windows Explorer, you can select SendTo. There's an option for Desktop (Create shortcut). This might help if you want VBA: Option Explicit Sub CreateShortCut() Dim myFileName As String Dim wsh As Object Dim SC As Object Dim myPath As String Dim myLinkName As String Set wsh = CreateObject("WScript.Shell") myPath = wsh.SpecialFolders.Item("Desktop") myLinkName = "mynicelink.lnk" myFileName = "C:\my documents\excel\book5.xls" On Error Resume Next Kill myPath & "\" & myLinkName On Error GoTo 0 Set SC = wsh.CreateShortCut(myPath & "\" & myLinkName) SC.TargetPath = myFileName SC.Save Set wsh = Nothing End Sub Russ Robelen wrote: Is there a way to create a desktop shortcut to an Excel file programmically in VBA? If so could you direct me to the code snippet that accomplishes it. ----- Dave Peterson wrote: ----- start "C:\my documents\excel\book1.xls" And put your prerecorded macro in a general module and name it Auto_Open. You could also just create a shortcut to your workbook (on your desktop???) and then start that, too. MS-DOS wrote: Is there a command I can use to launch excel from DOS, and also have it go right into a pre-recorded macro? thanks. -- Dave Peterson -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
need command
Many thanks Dave. This is exactly what I was looking for.
----- Dave Peterson wrote: ----- From a previous post: If you rightclick on the filename when you're in Windows Explorer, you can select SendTo. There's an option for Desktop (Create shortcut). This might help if you want VBA: Option Explicit Sub CreateShortCut() Dim myFileName As String Dim wsh As Object Dim SC As Object Dim myPath As String Dim myLinkName As String Set wsh = CreateObject("WScript.Shell") myPath = wsh.SpecialFolders.Item("Desktop") myLinkName = "mynicelink.lnk" myFileName = "C:\my documents\excel\book5.xls" On Error Resume Next Kill myPath & "\" & myLinkName On Error GoTo 0 Set SC = wsh.CreateShortCut(myPath & "\" & myLinkName) SC.TargetPath = myFileName SC.Save Set wsh = Nothing End Sub Russ Robelen wrote: Is there a way to create a desktop shortcut to an Excel file programmically in VBA? If so could you direct me to the code snippet that accomplishes it. ----- Dave Peterson wrote: ----- start "C:\my documents\excel\book1.xls" And put your prerecorded macro in a general module and name it Auto_Open. You could also just create a shortcut to your workbook (on your desktop???) and then start that, too. MS-DOS wrote: Is there a command I can use to launch excel from DOS, and also have it go right into a pre-recorded macro? thanks. -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
One command in one cell initiating another command in another cel. | Excel Worksheet Functions | |||
command code ( GOTO command) in formula | New Users to Excel | |||
command button add another command | Excel Discussion (Misc queries) | |||
Pivot Table Error Message - "Command Text not set for command obje | Excel Discussion (Misc queries) | |||
Excel has a "Find Next" command but no "Find Previous" command. | Excel Discussion (Misc queries) |