Results 1 to 4 of 4

Thread: open file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2001
    Posts
    302

    open file

    How can I ignore error messages when opening files that don't exist...

    for exmaple: Open FilePath For Input As #fnum.

    The filePath=c:\file.ini, doesn't exist. I want to end sub...

    how can I check if the file doesn't exist?


    thanks

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. If Dir$("c:\file.ini") <> "" Then
    2.    MsgBox "file exists"
    3. Else
    4.    MsgBox "file doesn't exist"
    5. End If

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2001
    Posts
    302
    Thanks Hack...

    How can I set a variable to the text to the right of the =?

    Ex: name=MyName...

    I want a variable (NameVar) to be set to "MyName"...


    Thanks

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I'm not sure I understand what you mean. Do you mean storing the name of the file you are looking for in a variable, and then running it through the Dirs$ function?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width