+ Reply to Thread
Results 1 to 8 of 8

Compile Error: Invalid Outside Procedure

  1. #1
    Registered User
    Join Date
    02-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    8

    Compile Error: Invalid Outside Procedure

    Hello, I hope that someone can help with the following problem.

    I have created an Excel file on my desktop (in Excel 2007) that contains some basic macro commands. This file is saved to my Dropbox cloud folder.

    I also have the same Dropbox cloud folder installed on my laptop.

    When I open the same Excel file on my laptop (running Excel 2010) I get a Microsoft Visual Basic screen (that relates to one of the Macros) pop up and the message, 'Compile Error: Invalid Outside Procedure'.

    I can close the Microsoft Visual Basic screen pop ups and carry on editing the file, but each time a make a change the same thing happens again, and I cannot run the macros.

    Any help on resolving this irritating issue would be much appreciated.

    Thank you.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Compile Error: Invalid Outside Procedure

    The code module starts with Private Sub....() and ends with End sub. Check if you have any lines of data outside these 2.

    Press Alt+F11 and it will bring up the code.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    02-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    8

    Re: Compile Error: Invalid Outside Procedure

    Thank you for replying. I will try that. I am not very technical with Excel or computing, so please bear with me if I get it wrong. Do I press Alt+F11 when I am seeing the Visual Basic pop-ups?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Compile Error: Invalid Outside Procedure

    Close the popup or click on OK button if present. Then while looking at your excel file, press Alt+F11.

  5. #5
    Registered User
    Join Date
    02-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    8

    Re: Compile Error: Invalid Outside Procedure

    ALT+F11 does not bring up anything on my laptop (it just allows me to adjust the speaker volume). Anyway, the visual basic pop-up looks like it is the code, and while I can see 'End Sub' when I scroll to the bottom of the code page, I cannot see 'Private Sub' anywhere on the page.

    The page starts as follows:

    '
    ' Pricecomma Macro
    ' Inserts commas in the price to pay
    '
    ' Keyboard shortcut: Ctrl+p
    '

    After that, there is all the specific macro code, and right at the bottom of that is, 'End Sub'.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Compile Error: Invalid Outside Procedure

    Ok, just before
    Please Login or Register  to view this content.
    put Private Sub Test() You can replace Test with anything.

  7. #7
    Registered User
    Join Date
    02-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    8

    Re: Compile Error: Invalid Outside Procedure

    That seems to have sorted it! Thank you very much.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Compile Error: Invalid Outside Procedure

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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