|
-
Nov 19th, 2007, 06:00 AM
#1
Thread Starter
Junior Member
[RESOLVED] Open Statement using a variable
I have 2 forms in this project.
I am opening a txt file using a common dialog function to select the file
and than storing that filename in a declared global variable as a string.
My problem comes when I open the second form
I need to be able to open the same file again to read the fields within.
The Open statement seems to only accept a filename and won't let me use the variable.
How can I open the file?
-
Nov 19th, 2007, 06:15 AM
#2
Frenzied Member
Re: Open Statement using a variable
can you post the code ?
This works just fine
Code:
Dim myvar As String
Dim mytext As String
myvar = "c:\test2.txt"
Open myvar For Input As #1
While Not EOF(1)
Line Input #1, mytext
MsgBox mytext
Wend
Close #1
-
Nov 19th, 2007, 06:27 AM
#3
Thread Starter
Junior Member
Re: Open Statement using a variable
Oops.
Yet, another easy solution.
I moved the variable to a global as I stated
and then redid my Open Statement on the second form and it worked.
I was placing the Open Statement under General Declarations instead of Form Activate.
Thanks ZeeZee
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|