Solved

How to open an executable from a button within a VB Appl

Posted on 2006-06-16
9
233 Views
Last Modified: 2010-04-30
I'm sure this is quite simple, but in my quick searches, I can't find a solution.

I am new to Visual Basic, although I'm proficient with VBA within MS Access.

I am attempting to create a very small VB program that opens a small window with some verbiage and a button.  The button should simply open up an executable application on the user's PC.

I already have the form (project) created and a button, but I can't figure out the VB code to perform this simple action.

The file is: C:\QMIS\QmisUI.exe

Thanks!
0
Comment
Question by:bkapla1
  • 6
  • 3
9 Comments
 
LVL 5

Expert Comment

by:lunchbyte
ID: 16921615
Shell

try Shell "C:\QMIS\QmisUI.exe"
0
 
LVL 5

Expert Comment

by:lunchbyte
ID: 16921621

' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)   ' Run Calculator.

Here is a better exmaple.
0
 
LVL 5

Expert Comment

by:lunchbyte
ID: 16921647
The regular shell will launch your program and continue on with the codes in your VB6. This API will launch your program and wait until that program is close then continue on with the codes in VB6.

http://freevbcode.com/ShowCode.Asp?ID=3441
0
 

Author Comment

by:bkapla1
ID: 16921662
Hmmm... still didn't work, I even tried your specific example of the calc.

The error is SecurityException was unhandled.... Request for permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed

I literally just installed VisualStudio express onto my PC this morning, so this is also the first time I've used it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:lunchbyte
ID: 16921668
LOL, you may want to post your question in vb.net. The code I gave you is for VB.

Someone who knows VB.net may come along but you need to post your question there for better help.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/
0
 
LVL 5

Accepted Solution

by:
lunchbyte earned 500 total points
ID: 16921694
0
 

Author Comment

by:bkapla1
ID: 16921699
Ahh... maybe that's the ticket... too many "types" of VB out there

I actually don't care what type of application it is as my goal is to simply have a quick and easy application on the user's desktop that will perform this function.

If I want to use straight VB vs. VB.net, how to I create a VB application (what development tool do I need to do this)?
0
 
LVL 5

Expert Comment

by:lunchbyte
ID: 16921717
You cannot buy VB6 anymore because it’s an old language and VB.Net is the next generation.  You already have Visual Studio express (free right) so you’re best bet is to start from there not the old language because it is different in many ways.
0
 

Author Comment

by:bkapla1
ID: 16921724
Ok, I'll keep trying.

Thanks for your help and clarification that Visual Studio uses VB.Net, not just VB... I'll get it straight!!

I'll give you the points for pointing me in the right direction!

Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Use Multiple Forms 4 49
Restricting text box entry from \/:?<>"| 9 76
change vba from autofit to 13.5 width? 4 28
Excel VBA, find a string in a column, update a cell 7 66
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now