open a text file

L

lumpy04

Hello,

I have a check list that we use to verify computer builds. I would like to
write code for a checkbox that wouls open a text file on a server. I have
tried 2 ways, neither work.
Private Sub Printers_Click()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f =
fs.OpenTextFile("\\usshl2-dplfsd01\data$\documentation\printers.txt",
ForAppending, TristateFalse)

End Sub


open \\usshl2-dplfsd01\data$\documentatio\printers.txt for random as #1

There must be a simple solution.....

TIA,
Mike
 
N

NickHK

VBA built in routines should be sufficient.
If this is an ANSI text file, then don't open in binary.
Also, is that path correct ? "documentatio"
The path/filename is a string, so enclose it in quotes.
And look at FreeFile in the help

Dim FileNum As Long
FileNum = FreeFile
Open "\\usshl2-dplfsd01\data$\documentation\printers.txt" For Input As
#FileNum
'...etc

NickHK
 

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