PDA

Click to See Complete Forum and Search --> : How to open a textfile in Notepad?


Ronnie Bussey
Jun 25th, 2000, 09:27 AM
Hi to All!

I'm stumped with something that I know has to be a simple procedure. Can anyone help...Please?

I am trying to make a VB "command button" open Notepad.exe + a specified .txt file. I can get Notepad to open but, I'm not sure of the proper syntax to open the textfile in Notepad.

Here is what I have so far, any suggestions would be most greatfully appreciated!:

Private Sub cmdCommand1_Click()
Call Shell("C:\windows\notepad.exe", vbNormalNoFocus)
End Sub


Many Thanks!

Ronnie Bussey

Gen-X
Jun 25th, 2000, 11:35 AM
You just pass the file you want to open as a parameter to the command line.


Private Sub cmdCommand1_Click()
Call Shell("C:\windows\notepad.exe " & Text1.Text, vbNormalNoFocus)
End Sub


Assuming of course that the TextBox named Text1 contains the name of the file you want opened with it.

Ronnie Bussey
Jun 26th, 2000, 09:40 AM
Hi Gen-X!

Thanks for the tip. I knew it had to be something fairly simple. I just couldn't find anything that referenced the proper syntax for the procedure.

Thanks again for your time and consideration!

Regards,

Ronnie Bussey