+ Reply to Thread
Results 1 to 4 of 4

Invalid outside procedure Error message

  1. #1
    Registered User
    Join Date
    11-07-2017
    Location
    Austin, TX
    MS-Off Ver
    2010
    Posts
    22

    Exclamation Invalid outside procedure Error message

    Hello,
    I'm trying to declare variables & constants and am getting "Invalid outside procedure" error message on "SET" no matter where I put the following:

    Please Login or Register  to view this content.
    What am I doing wrong? Any help is greatly appreciated.
    Thank you.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,997

    Re: Invalid outside procedure Error message

    The clue is in the message. You can't carry out commands outside a procedure ... that is, a subroutine or function.

    You can define the variables as public so they can be used and shared everywhere, but you have to set the values in a subroutine. Best bet is to use the Workbook Open Event handler.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    11-07-2017
    Location
    Austin, TX
    MS-Off Ver
    2010
    Posts
    22

    Re: Invalid outside procedure Error message

    Thanks. I misread the error message -- it should say "invalid outside *of* procedure". Thanks again.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,997

    Re: Invalid outside procedure Error message

    You're welcome. Thanks for the rep.


    Not sure I see the difference that makes, if I'm honest

    "Invalid outside procedure" or "Invalid outside a procedure" or "Invalid outside of procedure" or "Invalid outside of a procedure"; all much of a muchness. It is simply stating that 'the instruction is "Invalid outside procedure"'. I guess the intention is to keep the message short but maybe in this case it's "less is less" not "less is more".

+ 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] MACRO Error - 'Invalid outside procedure'
    By acl1992 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-07-2017, 07:05 AM
  2. Run time error '5': Invalid procedure call or argument getting error
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2014, 04:48 AM
  3. “Compile error: Invalid Outside Procedure”
    By Rajeshkumar R in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-26-2013, 04:32 AM
  4. [SOLVED] Compile Error: Invalid Outside Procedure
    By packet25 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-13-2013, 07:02 AM
  5. Invalid Outside procedure error
    By rmagers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2010, 08:45 PM
  6. invalid outside procedure error
    By trum01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2009, 07:20 AM
  7. Compile Error: Invalid outside procedure
    By smylod in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2009, 01:56 PM

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