Desktop Shorcuts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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).
 
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
| 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).
 
ahhhhh amaaazing,... that was just what I needed to deliver a project t
a client.

thanks loads!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top