+ Reply to Thread
Results 1 to 2 of 2

VB Macro "File Not Found"

  1. #1
    Registered User
    Join Date
    01-22-2004
    Location
    Visalia, CA / USA
    MS-Off Ver
    2016
    Posts
    76

    VB Macro "File Not Found"

    Here's a portion of code I'm using to sequential number and record quotes that we issue:

    Dim Cntr, QuoteNumber As Integer
    Cntr = FreeFile()
    Open "quotenm.txt" For Input As #Cntr
    Input #Cntr, QuoteNumber
    Range("g2") = QuoteNumber
    Close #Cntr

    Open "quotenm.Txt" For Output As #Cntr
    Write #Cntr, QuoteNumber + 1
    Close

    Sometimes (but not always) I get a "Runtime Error 53" - File Not Found.

    I suspect that it is only looking at .xls files - presumably the last way the Dialog Box was set. If that's the case, what line of code do I add to tell it to look in ALL files? (If I manually open the text file and then close it, then it finds it just fine).

    Thanks for any help.
    Bill in CA

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    1) Use the Chdrive and Chdir to go to the path of the text file or

    2) Put in the full path name for the txt file.


    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1