Solved

How to open a vbp file from visual basic application

Posted on 2002-06-19
5
2,782 Views
Last Modified: 2013-11-25
This must be simple, but i dont seem to get it right?

I have an application which has to open the source code of any application(ie will open a vbp file).

I have a TextBox (say text1) on the form which shows the path of the vbp project.

for eg:
Text1="\\rootpc\D\project\sourcecode\myproject.vbp"

Now at the click of a CommandButton, I write the following code:

Private Sub Command1_Click()
'it gives me an error at this call procedure, saying "Invalid procedure call or argument"

Call Shell(Text1, vbMaximizedFocus)

End Sub

But if i open an exe it works fine. I know I am missing something, anybody who can tell me what?

Thanks
-Priya

0
Comment
Question by:priya_pbk
  • 3
  • 2
5 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 7092124
try this:

Private 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
               
Private Const SW_SHOW = 1

...
  Dim hBrowse As Long
  hBrowse = ShellExecute(0&, "open", text1.text, "", "", SW_SHOW)
...

CHeers
0
 
LVL 2

Author Comment

by:priya_pbk
ID: 7092178
thanks, works fine!

BTW, what's the difference b/w Shell and ShellExecute apart from the fact that the later is faster?

-priya
0
 
LVL 2

Author Comment

by:priya_pbk
ID: 7092191
hey i dont' understand, I have accepted your answer(angelIII) twice by clicking the Accept comment as answer button, but it doesn't seem to work.

Any moderators who can help, I tried Reloading the Question, no luck!!

-priya
0
 
LVL 2

Author Comment

by:priya_pbk
ID: 7092206
oops!!forgot to click the grade -priya
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7092207
Accept worked...

Shell is a wrapper function of VB for the API shell, and by thus is faster. Of course, the API has more parameters for flexibility, but is not as simple to use as VB functions...

CHeers
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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

910 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

22 Experts available now in Live!

Get 1:1 Help Now