+ Reply to Thread
Results 1 to 2 of 2

Run time Error 5: Invalid procedure or argument

  1. #1
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    Run time Error 5: Invalid procedure or argument

    Looking for somw hwlp on an error I am getting regrding the below script. The script works fine if I remove the update_new reference and opens and closes the workbooks within the folder.

    However when I leave in the update_new reference it wont go any further than the first file found and returns

    Run time Error 5: Invalid procedure or argument at the line
    Please Login or Register  to view this content.
    So this is after it has ran the update_new script. I think the problem is to do with the change in directory but cant figure it out. Apprecaite any help on it. Thanks

    Please Login or Register  to view this content.
    I have attached the update_new code in book1.xls
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Run time Error 5: Invalid procedure or argument

    hi,

    I'm not certain but I agree with you that Dir is likely to be affected by the other macro (perhaps the "saveas" sections).
    To overcome this I suggest you loop right through the files & create an array of file names before processing them in the update_new macro. Here's an example of creating an array of filenames: http://spreadsheetpage.com/index.php...mes_using_vba/

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

+ 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