Running a shortcut

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

Guest

how do I run a .lnk file from VBA? I have tried the shell command but with no success. Any help appreciated.
 
Something like this may work for you:

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 a()
ShellExecute 0, "open", "C:\MyLink.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