Open uses the application's working directory. Normally, this is the location of the executable. If you're running in the IDE, this is normally the project folder.
Normally, you just include the full path name as a part of the file name. However, your example above is misleading. It SHOULD say
Open PathName For Input as #1
Or, use the ChDrive and ChDir statements to change the application's default directory.
Finally, the VB6 App object is very useful. One of it's properties, (Path) is often used.
Open App.Path & "\" & "FileName" For Input as #1
for instance. Be aware, however, that App.Path has one bug. IF your current directory is the root folder on a disk drive, app.path returns the trailing backslash. If you are in a different folder, it does NOT return the trailing backslash. (I believe this was reversed on Windows versions prior to Win XP)
A useful workaround is as follows:
Public Function AppPath () as String
Dim strPath as String
strPath = App.Path
If Right$(strPath,1) <> "\" Then
strPath = strPath & "\"
AppPath = strPath
Use it just as you would the App.Path property.
Last edited by loquin; 07-03-08 at 16:10.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert