Friday, August 27, 2010

VB6.0 Open EXE File

//With Shell Command

Private Sub Command1_Click()
Dim Ret As Variant
Ret = Shell("D:\kapil\projects\newdatastore\Dstore.exe", vbNormalFocus)
End Sub

//Without Shell Command

Private Sub Command2_Click()
Dim oWord
On Error Resume Next

Set oWord = GetObject("Word.Application")
If oWord Is Nothing Then
Set oWord = CreateObject("Word.Application")
End If

If oWord Is Nothing Then
MsgBox "Could not start Word"
Else
oWord.Visible = True
End If
End Sub

No comments: