Click to See Complete Forum and Search --> : Opening an application


Leo Koach
February 5th, 2000, 06:59 PM
I have the path of the text file, How am I going to open this text file in the notepad using vb. What should I use to tell to program open the notepad and put this text file in it. Or open an image in the Kodak viewer using VB. I know it's not shell bcause shell opens the program but it doesn't put the file in it.
Please help

Leo

Spectre
February 5th, 2000, 11:25 PM
You can use the shell command - it's first argument (although called pathname in the documentation) is used to pass the entire command line of the program being called so if your file were c:\Text.txt you could use:


Shell ("notepad.exe c:\Text.txt", vbNormalFocus)




This will launch notepad and pass to it the file c:\Text.txt. Keep in mind that the Shell command executes the called program asynchronously - that means that your program will continue with the next line immediately. The Shell command returns the TaksID of the program that you launched which can be used with the Windows API to monitor when that program exits.