Link to home
Start Free TrialLog in
Avatar of shaji_am
shaji_am

asked on

Reading a textfile in another system

Hi,
I am working in a VB project.I am using two systems - A & B - in the same network.I want to open a textfile in system B from an appliction running in system A.In system A I have only the IP address of system B.ie, using this IP I want to read the textfile in a folder in system B.
Any solution??????

Regards
Shaji_am
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

If you have permissions to the folder that contains the textfile in system B you can use UNC naming to retrieve it

Open "\\127.0.0.1\sharename\textfile.txt" For Input As #1

Here you can either use the computer name if known or the IP address instead. You need to be able to access the file/folder and have the necessary permissions to read this file but other than that it is straightforward.
Avatar of rpai
rpai

You could use the FileSystemObject to read the file.

Dim objFileSys As Object
Dim objFile As Object

Set objFileSys = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSys.openTextFile("\\173.23.37.3\MyTest\test.txt", 1)
s = objFile.readall
Debug.Print s
Set objFileSys = Nothing
Set objFile = Nothing
ASKER CERTIFIED SOLUTION
Avatar of Richie_Simonetti
Richie_Simonetti
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I somehow think you chose the wrong comment!
I hate this sort of things.
It alright, Tim and I have solved this matter, just wanted the rest of you know.  Stuff happeans.

Thanks all,
ComTech
CS Admin @ EE