Opening A VB Project File From A VB 6.0

naimish's Avatar
Invasive contributor


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


shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Moved to forum because I its too elementary to be an articles.
naimish like this