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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable in a text file

Status
Not open for further replies.

SerPan

Technical User
Sep 2, 2006
24
ES
Variable in a text file

I have a text file mycontrol.txt

In the first line have : 125.09

That is the variable value.

That variable must be in a path : X:\My documents\125.09\125.09.proyect.doc

I have to launch a bat or vbs program from several places and I would like to know how can I propose extracting from the text file the variable with the script and propose in the path......

Thanksss
 
Something like this maybe?

Code:
Dim FileNum as integer
Dim myvar as string
dim mypath as string

FileNum = Freefile()

Open "mycontrol.txt" for Input as #FileNum

Line Input #FileNum, myvar

Close #FileNum

mypath = "X:\My Documents\" & myvar & "\" & myvar & ".proyect.doc"

 
Looks fine, but I don't know if the program launch the .doc


Finally I have to launch the document.

I'll try the code and comment
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top