ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Desktop Shorcuts (https://www.excelbanter.com/excel-programming/313537-desktop-shorcuts.html)

asmenut

Desktop Shorcuts
 
Is there a way that I can (via VBA) create a shortcut to a spreadsheet or
folder on the desktop.
(Example: My application (wizard) has data for the user to fill out. When
he/she presses finish, the wizard fills out the form, creates a folder and
saves the form into that folder. The user then would like the wizard to
create a desktop shortcut to that folder so that he/she can work with the
files at a later time (Engineering Maintenence).

Jim Rech

Desktop Shorcuts
 
Here's an example:

Sub MakeDesktopShortcut()
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 = "C:\book1.xls"
SC.Hotkey = "CTRL+ALT+Z"
SC.Save
Set wsh = Nothing
End Sub

--
Jim Rech
Excel MVP
"asmenut" wrote in message
...
| Is there a way that I can (via VBA) create a shortcut to a spreadsheet or
| folder on the desktop.
| (Example: My application (wizard) has data for the user to fill out. When
| he/she presses finish, the wizard fills out the form, creates a folder and
| saves the form into that folder. The user then would like the wizard to
| create a desktop shortcut to that folder so that he/she can work with the
| files at a later time (Engineering Maintenence).



FastOneBaz[_8_]

Desktop Shorcuts
 

ahhhhh amaaazing,... that was just what I needed to deliver a project t
a client.

thanks loads!

--
FastOneBa
-----------------------------------------------------------------------
FastOneBaz's Profile: http://www.excelforum.com/member.php...nfo&userid=973
View this thread: http://www.excelforum.com/showthread.php?threadid=26924



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com