+ Reply to Thread
Results 1 to 7 of 7

Compilation Error: invalid outside procedure

  1. #1
    Registered User
    Join Date
    08-29-2014
    Location
    Behind my Computer
    MS-Off Ver
    2013
    Posts
    22

    Compilation Error: invalid outside procedure

    I'm trying to get a macro script to convert this:
    \1
    to this:
    \1
    .

    It basically has to search the name in the legend, change the color and copy the number/text below from the legenda.

    This is my current excel sheet:
    https://www.dropbox.com/s/7vjrzlw5d1...voor.xlsm?dl=0

    This is my current code:
    Please Login or Register  to view this content.
    It errors with "Compilation Error: invalid outside procedure".
    Can anyone help me?

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Compilation Error: invalid outside procedure

    you can only assign constants, not variables, outside a procedure
    Please Login or Register  to view this content.
    Last edited by JosephP; 09-02-2014 at 11:28 AM. Reason: clarification
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    08-29-2014
    Location
    Behind my Computer
    MS-Off Ver
    2013
    Posts
    22

    Re: Compilation Error: invalid outside procedure

    I'm trying again, now I got some really weir error:
    ByRef-argumenttypes mismatch
    Code:
    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Compilation Error: invalid outside procedure

    You haven't declared courceName anywhere so its data type defaults to Variant.

    To pass it to the sub GetCourseColor it needs to be declared as string you match the data type of the argument/parameter cource.

    Actually after looking at your code again there's quite a few problems with variable declarations, or the lack if them.

    PS You can assign constants inside/outside procedures.
    If posting code please use code tags, see here.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Compilation Error: invalid outside procedure

    your routines require you to pass a String to them but your variable is undeclared so it's a Variant. it's also spelled wrong
    Please Login or Register  to view this content.
    look up option explicit in help ;-)

  6. #6
    Registered User
    Join Date
    08-29-2014
    Location
    Behind my Computer
    MS-Off Ver
    2013
    Posts
    22

    Re: Compilation Error: invalid outside procedure

    I fixed that, now it's telling "error 1004 during execution". At this line:
    Please Login or Register  to view this content.
    in GetCourseColor
    Current code:
    Please Login or Register  to view this content.
    File download (if needed): https://www.dropbox.com/s/7vjrzlw5d1...voor.xlsm?dl=0

  7. #7
    Registered User
    Join Date
    08-29-2014
    Location
    Behind my Computer
    MS-Off Ver
    2013
    Posts
    22

    Re: Compilation Error: invalid outside procedure

    I got my macro working, thanks for all your help.

+ 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. 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
  2. “Compile error: Invalid Outside Procedure”
    By Rajeshkumar R in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-26-2013, 04:32 AM
  3. [SOLVED] Compile Error: Invalid Outside Procedure
    By packet25 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-13-2013, 07:02 AM
  4. Invalid Outside procedure error
    By rmagers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2010, 08:45 PM
  5. invalid outside procedure error
    By trum01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2009, 07:20 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