Below is BASIC code I use to open text file and it will display the Open file Dialog.
The question is can I open it directly by choosing the file name with out display the Open dialog box.
Guide and help is appreciated.
Function table_openFile (fileNum as Integer) fileName$ = "" Dim status as Integer fileN$ = "modify.txt" filter$ = "*.txt" direc$ = "C:\Documents and Settings\test\" fileNum = FreeFile status = MbeFileOpen (fileName$, fileN$, filter$, direc$) If status = MBE_Success Then On Error Goto CantOpen Open fileName For Input Access Read as fileNum End if table_openFile = status Exit Function
Han_BFY said:Can I open it directly by choosing the file name with out displaying the File Open dialog box
It's not clear what you are asking. If you want to 'choose' a file, that implies that you don't have its name. The File Open dialog lets your user choose a name.
If, on the other hand, you already know the name of the file, then you can open it using:
fileNum = FreeFileC:\Documents and Settings\test\han_by.txt" For Input Access Read as fileNum
Regards, Jon Summers LA Solutions
I try to open modify.txt file consist of data, now when I run macro it drive to dialog box to select the file I need.
what I want is run macro and macro will select the file directly without open the dialog box for user to select... just open "meaning to use that file" the needed file directly.
hope this clear..
"Have a nice day"