Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Place Shortcut On Desktop

I have the following code to save the current file in the existing folder
wherever that may be. :

'Save file with new name in existing path
sPathName = ActiveWorkbook.Path & "\"
sFileName = Range("File_SaveAs_Date_Sheet1").Value
sFileNamePath = sPathName & sFileName
ActiveWorkbook.SaveAs sFileNamePath

What I would like to be able to do is send a shortcut to the desktop for
easy access to this file. Ideally the shortcut would contain the file name,
as provided by sFileName = Range("File_SaveAs_Date_Sheet1").Value.

As a one off I can manually enter the path to desktop, but ideally this
would be obtained by the macro.

Many Thanks

Paul Moles
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Place Shortcut On Desktop

Take a look at this:
http://support.microsoft.com/default...b;en-us;242297
It describes how to use WScript.Shell to create a shortcut.

Hope that helped.

Shafiee.

"Paul Moles" wrote in message
...
I have the following code to save the current file in the existing folder
wherever that may be. :

'Save file with new name in existing path
sPathName = ActiveWorkbook.Path & "\"
sFileName = Range("File_SaveAs_Date_Sheet1").Value
sFileNamePath = sPathName & sFileName
ActiveWorkbook.SaveAs sFileNamePath

What I would like to be able to do is send a shortcut to the desktop for
easy access to this file. Ideally the shortcut would contain the file
name,
as provided by sFileName = Range("File_SaveAs_Date_Sheet1").Value.

As a one off I can manually enter the path to desktop, but ideally this
would be obtained by the macro.

Many Thanks

Paul Moles



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Place Shortcut On Desktop

Here is some code


Sub CreateShortCut()
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String

Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")

Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
ActiveWorkbook.Name & ".lnk")
With oShortcut
.TargetPath = ActiveWorkbook.FullName
.Save
End With
Set oWSH = Nothing

End Sub


--
HTH

Bob Phillips


"Paul Moles" wrote in message
...
I have the following code to save the current file in the existing folder
wherever that may be. :

'Save file with new name in existing path
sPathName = ActiveWorkbook.Path & "\"
sFileName = Range("File_SaveAs_Date_Sheet1").Value
sFileNamePath = sPathName & sFileName
ActiveWorkbook.SaveAs sFileNamePath

What I would like to be able to do is send a shortcut to the desktop for
easy access to this file. Ideally the shortcut would contain the file

name,
as provided by sFileName = Range("File_SaveAs_Date_Sheet1").Value.

As a one off I can manually enter the path to desktop, but ideally this
would be obtained by the macro.

Many Thanks

Paul Moles



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Place Shortcut On Desktop

http://msdn.microsoft.com/library/de...tcutobject.asp

That one is better. It tells you how to get the path of the desktop.

Shafiee.


"Paul Moles" wrote in message
...
I have the following code to save the current file in the existing folder
wherever that may be. :

'Save file with new name in existing path
sPathName = ActiveWorkbook.Path & "\"
sFileName = Range("File_SaveAs_Date_Sheet1").Value
sFileNamePath = sPathName & sFileName
ActiveWorkbook.SaveAs sFileNamePath

What I would like to be able to do is send a shortcut to the desktop for
easy access to this file. Ideally the shortcut would contain the file
name,
as provided by sFileName = Range("File_SaveAs_Date_Sheet1").Value.

As a one off I can manually enter the path to desktop, but ideally this
would be obtained by the macro.

Many Thanks

Paul Moles



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Place Shortcut On Desktop

Hello Paul
Here's one way (please amend accordingly - I have included your filename
variable)
Dim wsh As Object
Dim SC As Object
Dim DesktopPath As String
Set wsh = CreateObject("WScript.Shell")
DesktopPath = wsh.SpecialFolders.Item("Desktop")
Set SC = wsh.CreateShortcut(DesktopPath & "\test.lnk")
SC.TargetPath = sFileNamePath
SC.Icon = "d:\My Documents\phone3.ico"
SC.Hotkey = "CTRL+ALT+Z"
SC.Save
Set wsh = Nothing
Set SC = Nothing

HTH
Cordially
Pascal

"Paul Moles" a écrit dans le message
de news: ...
I have the following code to save the current file in the existing folder
wherever that may be. :

'Save file with new name in existing path
sPathName = ActiveWorkbook.Path & "\"
sFileName = Range("File_SaveAs_Date_Sheet1").Value
sFileNamePath = sPathName & sFileName
ActiveWorkbook.SaveAs sFileNamePath

What I would like to be able to do is send a shortcut to the desktop for
easy access to this file. Ideally the shortcut would contain the file
name,
as provided by sFileName = Range("File_SaveAs_Date_Sheet1").Value.

As a one off I can manually enter the path to desktop, but ideally this
would be obtained by the macro.

Many Thanks

Paul Moles



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
I want to place a calendar template on my desktop. AngieD Excel Worksheet Functions 1 December 17th 08 07:27 PM
How do I place shortcut to a particular document on my desktop? Tina Excel Discussion (Misc queries) 2 January 23rd 08 05:57 PM
How do I place shortcut to a particular document on my desktop? Tina Excel Discussion (Misc queries) 0 January 23rd 08 02:17 AM
Desktop Shortcut Tom New Users to Excel 1 October 23rd 06 01:00 AM
Desktop Shortcut Michael Rekas[_2_] Excel Programming 5 April 27th 04 06:23 PM


All times are GMT +1. The time now is 04:07 AM.

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

About Us

"It's about Microsoft Excel"