Some attributes are invalid within procedures. This error has the following cause and solution:
Remove the attribute from the procedure. To give the variable wider scope, move the declaration to module level. Variables declared within procedures are always Private.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).