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!

Recommended Answers

All 3 Replies

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.