Skip to content

ImplicitPublicMemberInspection

Max Dörner edited this page Jun 2, 2019 · 2 revisions

Description: Member is implicitly public

Type: CodeInspectionType.MaintainabilityAndReadabilityIssues

Default severity: CodeInspectionSeverity.Suggestion

This inspection finds procedure members (Sub, Function and Property) that are implicitly public.

Example:

Function GetFoo is implicitly public:

Function GetFoo() As Variant
End Function

If an access modifier isn't specified, a procedure member is Public by default. In other languages (including VB.NET), members are Private by default; for better maintainability, it's better to specify access modifiers explicitly.


QuickFixes

QuickFix: Specify Public access modifier explicitly

Public Function GetFoo() As Variant
End Function

By explicitly specifying the access modifier, there is no need for the maintainer to remember VBA's specific member visibility rules, which enhances readability and maintainability.

Clone this wiki locally