"Open" or "OpenText"?

E

Ed

The workbook I'm developing opens with a UserForm. I'd like to put an
"About" button on the form that opens a text file that describes its
functions a bit. Does Excel have a provision to open just a "read me" type
file? "Open" looked it was reserved for Excel files, and "OpenText" for
files to parse and import. Is one of these the right one to use, or is
there a better way?

Ed
 
M

Myrna Larson

If you want to open a text file with the intention of doing something with it
OTHER THAN putting the data on a worksheet, look at the VBA commands Open,
Input#, Close, etc.
 
D

Dick Kusleika

Ed

You can use the Shell function to open it in a certain program, e.g.
Notepad.

?shell("notepad.exe 'C:\Testfile.txt'")

The best thing, IMO, is too make another userform with a scrollable textbox
that has all this info. Then your button just shows this useform.

If you want to get fancy, you could do it in html and use the webbrowser
control on a userform as described here
http://www.dicks-blog.com/archives/2004/10/21/creating-help-files/
 
E

Ed

Myrna:

Thanks for the reply. I tried Open with the FSO in
Dim FName As String
Dim num As Integer
num = FreeFile()
FName = "C:\Documents and Settings\myname\Desktop\ROT\TestMe.txt"
Open FName For Random As #num

I saw nothing happen, and tried to walk through it again - the debugger told
me it was already open, but it wasn't visible anywhere, and I couldn't
figure out where to put in a Visible = True property. Can you see what I
did wrong?

Ed

Myrna Larson said:
If you want to open a text file with the intention of doing something with it
OTHER THAN putting the data on a worksheet, look at the VBA commands Open,
Input#, Close, etc.
 
E

Ed

Dick, it worked great! Thanks.
I had considered the UserForm, but it would seem much easier to replace a
simple text file for updates than to redo the text in a UserForm text box.
Am I missing something?

Ed
 
D

Dick Kusleika

Ed said:
Dick, it worked great! Thanks.
I had considered the UserForm, but it would seem much easier to
replace a simple text file for updates than to redo the text in a
UserForm text box. Am I missing something?
No, you're right, it is easier that way. I think the trade-off is how
professional it looks (and how much you care about that.) I think the html
and webbrowswer control is a good alternative because you can replace the
html file without changing the code.

If you want the best of both worlds, take Myrna's advice. Put your info in
a text file, then use VBA's text file keywords to read the text and insert
it in the textbox. It's a little more work up front coding all of that.

Dick
 
E

Ed

If you want the best of both worlds, take Myrna's advice. Put your info
in
a text file, then use VBA's text file keywords to read the text and insert
it in the textbox. It's a little more work up front coding all of that.
That does sound best, especially since I apparently managed to get the file
open (even though I thought it wasn't working because I couldn't see it).
Now I just have to figure out how to read it into a string. I think I
remember something about that in either a Help file, KB article, or previous
post - probably all three! But of course, that wasn't the answer I was
looking for so I blew right past it! Well, I can go find it again!

Thanks for the help, Dick.
Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top