Using vb to launch a shortcut

  • Thread starter Thread starter JT
  • Start date Start date
J

JT

We have macros that use a legacy program and either
extracts information from or updates info to the legacy
program.

Our instructions always tell the users to OPEN the legacy
program first, before starting the macro. We set the
legacy program as an object and then refer to the object
throughout the macro.

Is there a way for a macro to launch a desktop shortcut or
search for a file name on a PC's hard drive to start the
legacy program? Thanks.....
 
This launched a desktop shortcut for me:

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub LaunchLNK()
Dim DeskTop As String
DeskTop = CreateObject("WScript.Shell").SpecialFolders.Item("Desktop")
ShellExecute 0, "Open", DeskTop & "\ztree.lnk", "", "C:\", 1
End Sub
 

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