Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
One command in one cell initiating another command in another cel. Chas52 Excel Worksheet Functions 3 November 7th 09 06:57 PM
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


All times are GMT +1. The time now is 01:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"