VBA does not support namespaces (packages for Java poeple). Namespaces in other languages help avoid ambiguity and supplement tools like autocompletion of member names.
One way to simulate namespaces in VBA is to declare what are defacto static methods in a Class module and then declare a default instance of that class in a standard module. This is even the pattern followed in some Microsoft documentation. You can use this approach to nest pseudo-namespaces as well.
Do you, my peers, anticipate any technical problems with using this approach?
This is not a poll question; I'm not asking about the orthodoxy or aesthetic appeal. I'm asking, "will this cause problems? If so, what?"
Example:
' Class module called clsIOText
Public Function ReadAllText(ByVal FileName As String) As String
With New FileSystemObject
With .OpenTextFile(FileName, ForReading)
ReadAllText = .ReadAll
.Close
End With
End With
End Function
' Class module call clsIO
Public Text As New clsIOText
' In a standard module somewhere
Public IO As New clsIO
' Usage like a namespace
' 1. Fully qualified
Debug.Print IO.Text.ReadAllText("C:\temp\example.txt")
' 2. With a namespace alias-like object
Dim Text As clsIOText
Text = IO.Text
Debug.Print Text.ReadAllText("C:\temp\example.txt")