Illegal scope for PUBLIC or PRIVATE on: <name>

You used the Public or Private keyword in a declaration within a sub, function, or property. The Public and Private keywords are not legal in declarations in subs, functions, or properties. Public and Private only have meaning in declarations in module scope or within the definition of a user-defined class.

Remove the Public or Private keyword from the declaration.