Solved

How to open a vbp file from visual basic application

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

707 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

12 Experts available now in Live!

Get 1:1 Help Now