VB - Open notepad to read a textfile

Sharky Forums


Results 1 to 4 of 4

Thread: VB - Open notepad to read a textfile

  1. #1
    Catfish
    Join Date
    Sep 2000
    Location
    bc
    Posts
    185

    Question VB - Open notepad to read a textfile

    i know how to use:
    Code:
    shell "notepad filename.txt"
    but what if i want to declare the filename in a string var, how to open it using the shell command?
    because i want to open a filename with a date format (ex: logfile_2001-04-10)
    so i'll sth like:
    Code:
    Dim fileName as String
    fileName = "logfile_" & Format(date, "yyyy-mm-dd")
    but i dont know how to put it to the Shell command...

    pls help
    thx in advance

    ------------------
    Help!!! I'm swimming with the sharks...!!
    Help!!! I'm swimming with the sharks...!!

  2. #2
    Goldfish
    Join Date
    Nov 2000
    Posts
    61

    Post

    just use your filename variable in the shell statement.

    Ex:
    Shell fileName

  3. #3
    Catfish
    Join Date
    Sep 2000
    Location
    bc
    Posts
    185

    Post

    what if i make the filename NOT in txt file?
    i've tried like

    Shell "notepad fileName"

    but that won't work

    ------------------
    Help!!! I'm swimming with the sharks...!!
    Help!!! I'm swimming with the sharks...!!

  4. #4
    Goldfish
    Join Date
    Nov 2000
    Posts
    61

    Post

    Sorry, I forgot the reference to Notepad in my last post.

    Try something like:
    Shell "NotePad.exe " & FileName

    (where FileName is a string holding your path and filename)

    Make sure you get a space before the FileName. Could also write this as:
    Shell "NotePad.exe" & Space(1) & FileName

Posting Permissions

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