?
Solved

How can I launch or run an Shortcut (lnk) thru VB?

Posted on 2003-03-07
6
Medium Priority
?
220 Views
Last Modified: 2012-08-13
The shell command only seems to run .exe files?
I need to run a shortcut call name.lnk file? Is this possiable.
0
Comment
Question by:rquinn98
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Accepted Solution

by:
keenez earned 500 total points
ID: 8090115
Try shellExecute instead of shell.

Cheers,

Keenez
0
 

Expert Comment

by:thatdbme
ID: 8090430
I am not familiar with shellExecute.  I looked it up in MSDN but got no results, please explain keenez.

thatdbme
0
 
LVL 1

Expert Comment

by:winner21
ID: 8090847
the following is the code for your reference:

Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3

Public 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 RunYourProgram()
  Dim RetVal As Long
  On Error Resume Next
  RetVal = ShellExecute(0, "open", "<full path to program>", "<arguments>", "<run in folder>", SW_SHOWMAXIMIZED)
End Sub


Good luck.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:winner21
ID: 8090853
ShellExecute to start any program - including a short cut (.lnk) file - from inside VBA. This can be used in any of your VBA enabled programs - typically any of the applications in the Windows Office series
0
 

Author Comment

by:rquinn98
ID: 8133121
Yes, that worked !  Thank you.  It took a while for me to add the code but I was able to download it from the internet somewhere.   Thanks Again
0
 

Author Comment

by:rquinn98
ID: 8133136
Yes, that worked, I had a little trouble finding and implamenting the function, but I found some code off the internet.  Regards
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question