Solved

How to open a vbp file from visual basic application

Posted on 2002-06-19
5
2,790 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…

734 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