Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a file located on a network

Status
Not open for further replies.

Sangmond

Programmer
Sep 23, 2003
7
CA
I am trying to open a text file that is on a network, the path I am using is "//server/folder/text.txt"

So the code is like this

Open ""//server/folder/text.txt" For Input As testing
Input #testing, testdata
TextBox1.Value = testdata
Close testing

Put I kept on getting a msg say that runtime error 52 bad file name or number

Could anyone tell me how to work around this?

Thanks
Sangmond
 
use backslashes in the filename, like so:

\\server\folder\text.txt

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Sorry I just typed the slashes wrong in the post, put they are right in my program.

I am still getting the same error
 
How are you assigning the testing variable? Try using the lines:[tt]
Dim testing as Integer
testing = Freefile[/tt]
just before your:
[tt]Open "\\server\folder\text.txt" For Input As testing[/tt]

Also check that you have access and appropriate rights in the folder.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Great THanks for all of your help

I have got it to work now

Thanks
Sangmond
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top