Opening A VB Project File From A VB 6.0

Discussion in 'Visual Basic ( VB )' started by naimish, Sep 7, 2009.

  1. naimish

    naimish New Member

    Joined:
    Jun 29, 2009
    Messages:
    1,043
    Likes Received:
    18
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Location:
    On Earth

    Introduction



    Hi Friends,

    Today morning I need to create an application which is build in VB 6.0 and I wanted to open another VBP file from my existing project.

    I Googled it a lot but couldn't found anything, however I managed to achieve it anyhow, so this would be helpful to you also.

    Background



    On Button Click, It will open a new VBP Project.

    The code



    Code: VB 6.0

    Code:
    'in General-Declarations:
    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 Sub Form_Load()
    	'open a file
    	ShellExecute Me.hWnd, "open", "C:\Test1.vbp", vbNullString, "C:\", ByVal 1&
    End Sub
    
    Private Sub OpenAFile(strFileLocation As String)
    	'Just call the OpenAFile sub with the path of the file to open as its parameter.
    	If Dir$(strFileLocation) = "" Then
    		Exit Sub
    	End If
    	ShellExecute Me.hWnd, "open", strFileLocation, vbNullString, "C:\", ByVal 1&
    	'Example code (same effect as the examples above)
    	Call OpenAFile("C:\Test1.vbp")
    End Sub
    
    Private Sub Command1_Click()
    	OpenAFile ("C:\Test1.vbp")
    End Sub

    Thanks :)

     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Moved to forum because I its too elementary to be an articles.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice