Solved

How to open a vbp file from visual basic application

Posted on 2002-06-19
5
2,796 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
[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
  • 3
  • 2
5 Comments
 
LVL 143

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 143

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…
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…
Suggested Courses
Course of the Month3 days, 19 hours left to enroll

630 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