943,823 Members | Top Members by Rank

Ad:
Jun 29th, 2007
0

Open a text file in notepad

Expand Post »
Hi all, I'm building a simple logging program in VB5. I'm entirely self-taught using a couple books and the help files, so if I'm missing something obvious, that's probably why.

Anyway, I'm trying to get my program to be able to open old logs in notepad. I can't seem to to figure out how to do this. I've tried the Shell function, but that just opens notepad. When I try to specify my file instead of the program it gives me an error (Invalid procedure call or argument) which doesn't really surprise me.

I'm assuming I need to open notepad, and then tell it to open the file, I just don't know how and can't seem to figure it out..

Thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
silverfire is offline Offline
2 posts
since Jun 2007
Jun 29th, 2007
0

Re: Open a text file in notepad

Try this

dim linne as string

linne = "notepad d:\test\testfile.txt"
shell linne


That should work (obviously replace my file and folder name with yours)

Denis
Reputation Points: 22
Solved Threads: 19
Posting Whiz
DenisOxon is offline Offline
345 posts
since Jan 2007
Jun 29th, 2007
0

Re: Open a text file in notepad

Thanks! It worked. As soon as I saw it, I knew what I was missing. Now I have to see if I can replace notepad with the system defined text editor. Don't tell me how yet though, I want to ry to solve it on my own. It's amazing what I can learn by accident...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
silverfire is offline Offline
2 posts
since Jun 2007
Jun 30th, 2007
0

Re: Open a text file in notepad

Click to Expand / Collapse  Quote originally posted by silverfire ...
Thanks! It worked. As soon as I saw it, I knew what I was missing. Now I have to see if I can replace notepad with the system defined text editor. Don't tell me how yet though, I want to ry to solve it on my own. It's amazing what I can learn by accident...

Glad to hear it worked.

A little tip if I may (don't look if you don't want to) ....
























































Without using Shell command use the windows run command to test the line you are going to use e.g Notepad file.txt. If that works Shell will work most times. There are other fiddles I know if you get stuck.

Denis
Reputation Points: 22
Solved Threads: 19
Posting Whiz
DenisOxon is offline Offline
345 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Save/Load Picture on DB
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Help me with DtPicker Control





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC