PDA

Click to See Complete Forum and Search --> : geting varibles from an external file


Aaron Young
Dec 13th, 1999, 12:08 AM
Use the VB File Functions, Open.. For.. As.., eg.

Dim iFile As Integer
iFile = FreeFile
Open "C:\TheFile.txt" For Input As iFile
Input #iFile, sWebURL
Close iFile
Msgbox "The URL is " & sWebURL

If the file contains more than one bit of information, you would continue to use the Input# function until EOF(iFile) is True indicating the End of the File has been Reached.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net


[This message has been edited by Aaron Young (edited 12-13-1999).]

andywallace
Dec 13th, 1999, 03:43 AM
Thanks this worked great. However how do i code the path to the file so it will be relative to my exe file?

Aaron Young
Dec 13th, 1999, 06:05 AM
The App.Path Property will contain the Directory Path from which your Application was launched.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

andywallace
Dec 13th, 1999, 11:58 AM
Hi all
i need to read a file which will contain some varibles e.g a web address. How do i open the file read in the web address and put this address into a varible? The file it will open is a plain text file only containing on line which id the web address.

Andy@webfx3.freeserve.co.uk