Re: create a shortcut in VBA

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



You don't need to use a separate VBScript. Just include the statements
to create and manipulate the WScript.Shell object in an ordinary VBA
procedure.

But read the documentation so you understand what you're doing.

On Sun, 22 Jan 2006 16:37:16 GMT, "Robert M via AccessMonster.com"
<u11609@uwe> wrote:

>
>Thanks, John. Now, I hate to be such a stupe but could you show me how to
>invoke/launch a script from VBA code?
>
>John Nurick wrote:
>>Hi Robert,
>>
>>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
>>
>>>I am using an Access db to update an exisitng db or install new if necessary.
>>>I would like to copy an exisitng shortcut to the users desktop. Can this be
>>>done in code? If not, how do I create a shortcut in code?
>>
>>--
>>John Nurick [Microsoft Access MVP]
>>
>>Please respond in the newgroup and not by email.

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.

.



Relevant Pages

  • Re: Is creating this shortcut possible?
    ... The WSH Shell object includes methods for ... This sample code is from the Windows Script 5.6 ... >and a folder on the hard drive to hold documents, xls files, etc. ... >Can I automatically create a shortcut to that folder and place it on ...
    (microsoft.public.access.formscoding)
  • Re: create a shortcut in VBA
    ... so it would probably go in an installation routine - which ... shortcut to be created. ... This sample code is from the Windows Script 5.6 ... >> Please respond in the newgroup and not by email. ...
    (microsoft.public.access.formscoding)
  • Re: create a shortcut in VBA
    ... The WSH Shell object includes methods for ... This sample code is from the Windows Script 5.6 ... >I am using an Access db to update an exisitng db or install new if necessary. ... >I would like to copy an exisitng shortcut to the users desktop. ...
    (microsoft.public.access.formscoding)