Executing a program through Visual Basic.

bmxmikey861
02-15-2003, 07:33 AM
Say i want to open myfile.exe. I want it to open as if i went though the folder and double clicked on it. I have been searching on how to do this and alls i find it just how to open it to read it. Not to execute it.

rimby
02-15-2003, 07:38 AM
You really should do some more searching before you post. This has been discussed countless times.

Try this code though:


Shell "C:\Windows\Notepad.exe", vbNormalFocus

If the file does not exist, you will get a "File not found" run-time error.

Deadalus
02-15-2003, 07:50 AM
To open a file with the associated program, use ShellExecute.
http://www.allapi.net/apilist/ShellExecute.shtml

bmxmikey861
02-15-2003, 08:23 AM
I get a invalid call procedure or argument when i open a *.mdl file. But when i open Notepad it doesn't do that.

vbfan
02-15-2003, 08:27 AM
with the Shell function you can only start exe-Files nothing else.

bmxmikey861
02-15-2003, 08:31 AM
NEVERMIND ALL

I got it all to work. Thanks for all your help.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum