View Single Post
Old 09-18-2016, 08:16 PM
leezinho leezinho is offline
Join Date: Jun 2009
Posts: 67
Default Path of data file in same directory as .exe

During development, I have told my program where to find its data by specifying the full path (C:\...) to where the data file is located on my computer. But when the program is exported to other computers, the data file will be located in the same folder with the .exe file of the program, and I need a generic expression for the path which will work on other computers, without my knowing what name users will give to the folder where they locate the program and data file. I have tried saying simply "Open [filename.extension] for Input As 1", assuming it will be understood that without the Drive and Directory specifications the default will be the directory where the program is located. But this approach gets me the message "Error 76: Path Not Found". This is hard to debug, because it happens only on someone else's compter, running the .exe file. Is there a way to designate a data file in the same folder generically? Or do I have to tell users what path and directory name they have to put the program and data in? I have not found an answer in the 642 pages of Programmerís Guide VB 5.0.
Reply With Quote