The "Open" statement

C

carl0s66

I'm struggling with the syntax of the open statement, the helpfil
states it as

-Open pathname For mode [Access access] [lock] As [#]filenumbe
[Len=reclength]-

I know this makes me look thick but I've tried various things that hav
all failed, can someone give me an example of how this would look for
file named "carrier" that I wanted to input to as the mode?

Thank
 
J

JE McGimpsey

Say the file "carrier.csv" exists in the directory "C:\temp\". Here's
one way:

Const sPATH As String = "C:\temp\"
Dim nFileNum As Long

nFileNum = FreeFile
Open sPATH & "carrier.csv" For Input As #nFileNum
 
J

JE McGimpsey

Yes, but the FreeFIle method automatically produces the next free file
number, so it's a bit safer in cases where you may have multiple files
open.
 

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