Skip to content

ImplicitPublicMemberInspection

Mathieu Guindon edited this page Mar 5, 2015 · 1 revision

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.