+ Reply to Thread
Results 1 to 4 of 4

Invalid Outside Procedure error... doesn't like "Application"

  1. #1
    Registered User
    Join Date
    02-12-2020
    Location
    Cincinnati, OH
    MS-Off Ver
    2017
    Posts
    6

    Question Invalid Outside Procedure error... doesn't like "Application"

    My colleague and I use the Macro I'll paste below to pull out highlighted yellow cells and add them to another sheet that the Macro creates. For some reason, it has stopped working on his computer. When he runs the code, he gets an "Invalid Outside Procedure" error and it highlights "Application" in the code. Application is used several times within the code, and when I had him delete the first instance of it, it gave the same error and highlighted the next one. I don't understand why it would suddenly stop working for him, and continue working for me. See the code below:

    Please Login or Register  to view this content.
    Last edited by mackattacker; 05-07-2020 at 03:54 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Invalid Outside Procedure error... doesn't like "Application"

    This error indicates that there is a line of executable code that is located outside a procedure. This is a compiler error; the code is not even running. This means that the code you pasted here is not exactly the code on your colleague's computer.

    Look at his computer, and see if there is any code that occurs anywhere besides between Sub...End Sub. From your description my first guess is that the the first Sub line is missing.
    Last edited by 6StringJazzer; 05-07-2020 at 07:13 PM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    02-12-2020
    Location
    Cincinnati, OH
    MS-Off Ver
    2017
    Posts
    6

    Re: Invalid Outside Procedure error... doesn't like "Application"

    You nailed it. He was sharing his screen with me and pasted the Macro code into this workbook and it wasn't working, so I was perplexed. But when I got into the actual workbook itself, I can see he had already pasted it into the workbook previously and left off the beginning Sub line, and it was trying to run that code and getting lost in itself. Thank you so much.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Invalid Outside Procedure error... doesn't like "Application"

    You have no idea how happy it makes me to correctly diagnose a code problem without seeing the actual code that caused the problem

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking on the star icon addreputationiconsmall.jpg below their name.

+ 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] WinHTTP (or XMLHTTP) bypas "the hostname in the certificate is invalid or doesn't match"
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-22-2018, 10:11 AM
  2. I am getting this error by below macro "Invalid procedure call arguement" please help
    By shoaibaligwl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2017, 09:39 AM
  3. help with "invalid procedure call or argument" error.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2017, 11:41 AM
  4. [SOLVED] run time error '5" invalid procedure call or argument
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-12-2015, 12:29 PM
  5. Run-time Error 5 "Invalid Procedure Call or Argument"
    By dinakar.yadav in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2014, 09:22 AM
  6. WritetoSheet causing "invalid procedure call or argument"
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2013, 03:46 PM
  7. "Invalid procedure call or argument" error when creating Pivot table
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2009, 06:02 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