Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   Opening A VB Project File From A VB 6.0 (http://www.go4expert.com/forums/vb-project-file-vb-60-t19328/)

naimish 7Sep2009 12:23

Opening A VB Project File From A VB 6.0


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.


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

The code

Code: VB 6.0


'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 :)

shabbir 7Sep2009 13:38

Re: Opening A VB Project File From A VB 6.0
Moved to forum because I its too elementary to be an articles.

All times are GMT +5.5. The time now is 10:38.