M MS-DOS Dec 19, 2003 #1 Is there a command I can use to launch excel from DOS, and also have it go right into a pre-recorded macro? thanks.
Is there a command I can use to launch excel from DOS, and also have it go right into a pre-recorded macro? thanks.
D Dave Peterson Dec 20, 2003 #2 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.
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.
G Guest Jan 2, 2004 #3 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 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
D Dave Peterson Jan 3, 2004 #4 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
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
G Guest Jan 3, 2004 #5 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
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