how to open enternal text file

  • Thread starter Thread starter Haggr1 via AccessMonster.com
  • Start date Start date
H

Haggr1 via AccessMonster.com

trying to open an external text file using a command button on a form. Here
is what I have so for:

Call Shell("TEXT.txt \\C:\labels.txt", 1) but I get "file not found"

I am sure it is the "TEXT.txt" that is causing the problem because I was
guessing. Thanks
 
In
Haggr1 via AccessMonster.com said:
trying to open an external text file using a command button on a
form. Here is what I have so for:

Call Shell("TEXT.txt \\C:\labels.txt", 1) but I get "file not
found"

I am sure it is the "TEXT.txt" that is causing the problem because I
was guessing. Thanks

You could shell to Notepad.exe and pass it the path to the file; e.g.,

Shell "Notepad.exe ""C:\labels.txt""", vbNormalFocus

or you could just treat the file path as a hyperlink, and instruct
Access to "follow it":

Application.FollowHyperlink "C:\labels.txt"
 
Notepad.exe worked great

Used "Application.FollowHyperlink" to open a "Cobol" app and it does work,
but I would like to not have to click the "Microsoft Office" warning message
about viruses etc. Thanks

What does "vbNormalFocus" do?

Dirk said:
trying to open an external text file using a command button on a
form. Here is what I have so for:
[quoted text clipped - 4 lines]
I am sure it is the "TEXT.txt" that is causing the problem because I
was guessing. Thanks

You could shell to Notepad.exe and pass it the path to the file; e.g.,

Shell "Notepad.exe ""C:\labels.txt""", vbNormalFocus

or you could just treat the file path as a hyperlink, and instruct
Access to "follow it":

Application.FollowHyperlink "C:\labels.txt"
 
Back
Top