Is creating this shortcut possible?

  • Thread starter Thread starter Doug Sanders
  • Start date Start date
D

Doug Sanders

I'm working in both Access '97 & 2k.

A user creates a new customer file. This creates a record in the database
and a folder on the hard drive to hold documents, xls files, etc.

(How) Can I automatically create a shortcut to that folder and place it on
the users desktop?

Thanks,
Doug Sanders
 
Hi Doug,

The WSH (Windows Script Host) Shell object includes methods for
manipulating shortcuts. This sample code is from the Windows Script 5.6
Help (Script56.CHM; it's installed if you download the latest Windows
Script stuff from support.microsoft.com).

Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\test.lnk")
link.Arguments = "1 2 3"
link.Description = "test shortcut"
link.HotKey = "CTRL+ALT+SHIFT+X"
link.IconLocation = "foo.exe,1"
link.TargetPath = "c:\blah\foo.exe"
link.WindowStyle = 3
link.WorkingDirectory = "c:\blah"
link.Save
 
Thanks, I'll give this a try.

Doug


John Nurick said:
Hi Doug,

The WSH (Windows Script Host) Shell object includes methods for
manipulating shortcuts. This sample code is from the Windows Script 5.6
Help (Script56.CHM; it's installed if you download the latest Windows
Script stuff from support.microsoft.com).

Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\test.lnk")
link.Arguments = "1 2 3"
link.Description = "test shortcut"
link.HotKey = "CTRL+ALT+SHIFT+X"
link.IconLocation = "foo.exe,1"
link.TargetPath = "c:\blah\foo.exe"
link.WindowStyle = 3
link.WorkingDirectory = "c:\blah"
link.Save
 
Back
Top