Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 1.49 KB

invalid-outside-procedure.md

File metadata and controls

24 lines (16 loc) · 1.49 KB
title keywords f1_keywords ms.assetid ms.date ms.localizationpriority
Invalid outside procedure
vblr6.chm1040051
vblr6.chm1040051
46c00b2b-c656-9ad4-bff9-d341a6a7ecd5
06/08/2017
medium

Invalid outside procedure

The statement must occur within a Sub or Function, or a property procedure (Property Get, Property Let, Property Set). This error has the following cause and solution:

  • An executable statement, Static or ReDim, appears at module level.

    Static is unnecessary at module level, since all module-level variables are static. Use Dim instead of ReDim at module level. To create a dynamic array at module level, declare it with Dim using empty parentheses.

    Note At module level, you can use only comments and declarative statements, such as Const, Declare, Deftype, Dim, Option Base, Option Compare, Option Explicit, Option Private, Private, Public, and Type. The Sub, Function, and Property statements occur outside the body of their procedures, but within the procedure declaration.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

[!includeSupport and feedback]