+ Reply to Thread
Results 1 to 3 of 3

Invalid procedure call argument

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Invalid procedure call argument

    Hello,

    I am running this script:

    Please Login or Register  to view this content.
    After the first round in the loop, I am getting a Run Time Error '5' - Invalid procedure., however, if I remove the "IF" procedure, the script runs through.


    What is wrong here? Could you please advise?
    Thanks

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Invalid procedure call argument

    Maybe test first if the wildcard is the issue

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,154

    Re: Invalid procedure call argument

    You cannot use Dir inside the loop, otherwise you destroy the stack, from the first Dir.
    To check if the file exists in a different folder use file system objects.
    https://analystcave.com/vba-filesyst...ba-fileexists/

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Invalid procedure call or argument
    By FaleoMD in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 07-24-2020, 01:12 AM
  2. Invalid Procedure Call or Argument
    By theTaoJones in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2018, 03:23 PM
  3. Invalid procedure call or argument?
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2017, 10:15 AM
  4. Invalid procedure call or argument
    By Netzqua in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2016, 11:45 AM
  5. Invalid procedure call or argument
    By krish T in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-31-2010, 10:01 AM
  6. Invalid procedure call or argument
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-08-2007, 06:01 AM
  7. Invalid Procedure call or argument
    By T De Villiers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2006, 10:05 AM

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