Computer Science Canada

Opening file / VB6

Author:  Megatokyoguy [ Fri May 30, 2008 11:33 am ]
Post subject:  Opening file / VB6

I've used the shell command to try and open files, eg;

Shell "Whatever_File.txt", vbNormalFocus

It works fine, but it can only open specific files such as .exe's and .txt's. I can get it to open images by using something like;

Shell "C:\WINDOWS\SYSTEM32\MSPAINT.EXE Whatever_File.bmp", vbNormalFocus

Now the problem with shell commands is that they can only open specific types of files, and others only if you specificy a program that will open them (like above). On of that, it does not support spaces in the directory\file!

I want it to open files through VB the same way as Windows Explorer does, such as double clicking, & the particular file opens with the default program. I have tried the ShellExecute command & was not able to make it work. Is there an alternative to shell?


: