VBA Compile Error: Procedure Too Long

I ran into a very strange error recently when I took over someone elses MS Access project. The so called developer did not use Option Explicit anywhere in the code so I added it into all modules and fixed all the misspelled variables and missing variables. Then the final Error I got when compiling was "Procedure Too Long"! That was odd as the routine in question was maybe 1000 lines long so it was NOT too long at all. After reviewing the code in more detail I decided to change some of the massive If-Then-Else blocks into Case Statements and just like magic, after the first one, I was able to get past this stupid error.

There must be some sort of limitation on the number of If-Else statements in VBA routines.

How to Increase the Outlook Attachment Size Limit

from here: https://www.lifewire.com/increase-outlook-attachment-size-limit-1173679 

Increase the Outlook Attachment Size Limit

To change the size Outlook allows as a maximum for attachments to send:

  1. Press the keyboard shortcut Windows-R.
  2. Type "regedit" in the Run dialog.
  3. Click OK.
  4. Travel down the registry tree to the entry corresponding to your Outlook version:
    • Outlook 2010: HKEY_CURRENT_USER\­Software\­Microsoft\­Office\­14.0\­Outlook\­\Preferences.
    • Outlook 2013: HKEY_CURRENT_USER\­Software\­Microsoft\­Office\­15.0\­Outlook\­\Preferences.
    • Outlook 2016: HKEY_CURRENT_USER\­Software\­Microsoft\­Office\­16.0\­Outlook\­\Preferences.
  5. Double-click the MaximumAttachmentSize value.
    • If you cannot see MaximumAttachmentSize:
      1. Select Edit | New | DWORD Value from the menu.
      2. Enter "MaximumAttachmentSize" (not including the quotation marks).
      3. Press Enter.
      4. Now double-click the MaximumAttachmentSize value you just created.

  1. Enter the desired attachment size limit in KB under Value Data:.
    • To set a size limit of 25MB, for example, enter "25600."
    • The default value (with MaximumAttachmentSize not present) is 20MB or 20480.
    • For no attachment file size limit, enter "0." Practically all mail servers have a size limit, though, so "0" is not recommended; you would invariably get large messages back as undeliverable after an often long and fruitless uploading process.
    • Ideally, the limit corresponds to your mail server's limit. Reduce the Outlook limit by some 500KB to allow wiggle room.

  1. Click OK.