I want to know how to open a file existing in a computer in vb 6.For example I want to open notepad when I click a button.notepad.exe exists in C:\WINDOWS\.So when I click the button notepad.exe should execute.Also tell me how can I generalise this to any computer(means computer where windows is installed in a drive other than C).

to open any exe use SHELL from vb6.0

to open any exe use SHELL from vb6.0

could you please give me the exact syntax.

Private Sub Command1_Click()
Shell "C:\Windows\notepad.exe", vbMaximizedFocus
End Sub
Private Sub Command1_Click()
Shell "C:\Windows\notepad.exe", vbMaximizedFocus
End Sub

how can we open ""text.txt" ???????

try this

Private Sub Command1_Click()
Shell "C:\Windows\notepad.exe","c:\text.txt" vbMaximizedFocus
End Sub

if you want open exe file you can use
Shell "notepad.exe"
if you want open other file type u must use windows api

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.