Receiving "compile error: invalid outside procedure"

  • Hello everyone, new to this site so not sure if this is the appropriate spot to post. Upon opening my spreadsheet I'm receiving the following error pop up and VBA viewer opens.

    Compile error:
    Invalid Outside Procedure

    Two windows of code appear beneath it as well:

    Module 10



    Module 8



    It appears to be affecting every spreadsheet using the same tempelate format. I'm not too familiar with macros or VBA so any help would be greatly appreciated.

    Thanks,

  • Re: Please Help..receiving "compile error: invalid outside procedure"


    That's odd, this sheets not even protected. The template is on a shared drive, I don't how this can affect spreadsheets that were saved a year ago, when this just started happening.

  • Re: Receiving "compile error: invalid outside procedure"


    Doc Grimm,

    Please take note of the changes made to your post. Firstly, any VBA code must be wrapped with [noparse]

    Code
    Your code here

    [/noparse] tags. Secondly please use Search Friendly Key Words only for titles, including Please Help.. and similar words makes it more difficult to search for appropriate threads.

    Both the pieces of code you have posted are identical. Neither have a correct procedure header (Sub <procedure name> or Private Sub <procedure name>).

    As Cytop mentions the code appears to be attempts at cracking a Worksheet password, you will need to explain in more detail as to how this situation has arisen.

  • Re: Receiving &quot;compile error: invalid outside procedure&quot;


    The code would only be used to crack a password. Prehaps, sometime in the dim, dark, distant past someone forgot a password and resorted to coding to try and break it.

    You can most likely delete that code without affecting any other macros, but the usual "work on a copy first" warning applies.

  • Re: Receiving &quot;compile error: invalid outside procedure&quot;


    Thanks for the quick responses, I agree this may have been some sort of pass cracker someone tried to use for a forgotten password.

    Cytop - deleting the code works well without any conflicts but I'm running into this on every sheet I open. All sheets that show this error appear to be linked to the template they were created from, but when I delete the code from the template I still receive an error even though the template opens fine.

  • Re: Receiving &quot;compile error: invalid outside procedure&quot;


    I'm no expert on templates, but I'd guess they're not 'linked' to the template, but are copies of the template. The code would have been included when the file was created using the template.

    It looks like the code might have been modified unintentionally (or otherwise). The fact the same code with the same issue appears in 2 modules points to someone not quite knowing what they were doing.

    If this was a long-standing issue it would have been very evident so something happened sometime recently. I would guess you'll have to open any affected workbooks and remove the code manually before saving again. It would be possible to automate that, but that'd be a lot of coding and by your own admission ...

    Quote

    I'm not too familiar with macros or VBA

  • Re: Receiving &quot;compile error: invalid outside procedure&quot;


    To me, there has to be some sort of common denominator. The problem started ocurring roughly a month ago but yet workbooks that were created and saved over a year ago, and there are hundreds, are being affected as well. I probably just delete the code from some of the recent workbooks and leave it at that.

    Thanks for the help.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!