How to open file directly?

Dear Friends,

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.

Thank you 

Code :

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
Parents
  • 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 = FreeFile
    C:\Documents and Settings\test\han_by.txt" For Input Access Read as fileNum

     
    Regards, Jon Summers
    LA Solutions

Reply Children
No Data