Results 1 to 3 of 3

Thread: How to open a textfile in Notepad?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Texas
    Posts
    2

    Question

    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


  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    You just pass the file you want to open as a parameter to the command line.

    Code:
    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Texas
    Posts
    2

    Smile Thank You!

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width