+ Reply to Thread
Results 1 to 3 of 3

Referencing 2nd Selected Filename = Runtime Error 5 ???

  1. #1
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    221

    Referencing 2nd Selected Filename = Runtime Error 5 ???

    HELP! I revised a macro for a client, and now it gives him a run-time error. Macro used to allow user to select ONE file for processing. Client wanted to select multiple files, and have the macro process them one after another. So I just added a loop and changed the code to allow selection of multiple files. The loop increments a counter to open and process each file.

    Problem: The macro runs fine for me (it will open and process multiple files as desired, with NO errors). I'm running Excel 2007. Client is running Microsoft 365 and the macro bombs for him. It opens and processes the first file just fine, but throws the run-time error when it tries to get the filename and path for the second selected item. Any ideas on what the cause / fix could be?

    Here is the relevant portion of the code. Sets a run-time error 5 (Invalid procedure call or argument) at the "FilePath = ..." statement, when FileCounter = 2
    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Referencing 2nd Selected Filename = Runtime Error 5 ???

    I don't know if this would help, but here is another way to write the code.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    221

    Re: Referencing 2nd Selected Filename = Runtime Error 5 ???

    Thanks for the suggestion! I will give that a try tomorrow and see if it works any better.

+ 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. [SOLVED] RunTime error 70 on Kill(Filepath & Filename)
    By Kramxel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2017, 11:03 AM
  2. [SOLVED] Runtime 1004 after prompting for filename but not when filename hard coded.
    By cgoodenough in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-04-2013, 03:46 AM
  3. Referencing filename to a Cell
    By Laylow in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2011, 10:27 AM
  4. runtime error "1004", no data selected to parse
    By surgical in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2010, 11:41 AM
  5. Referencing a filename in a cell
    By jondl in forum Excel General
    Replies: 2
    Last Post: 12-20-2007, 03:11 PM
  6. Referencing filename in a saveas function
    By Mechroneal in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-03-2007, 09:53 AM
  7. Referencing a filename in a formula
    By ERR229 in forum Excel General
    Replies: 2
    Last Post: 05-12-2006, 02:50 AM

Tags for this Thread

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