I have this simplified class module clXXX....
':: backing field
Private fTemplateBk As Excel.Workbook
':::::::::::::::::::::::::::
'::
':: constructor
Private Sub Class_Initialize()
End Sub
':::::::::::::::::::::::::::
'::
':: properties
Property Get TemplateBk() 'As Excel.Workbook '<< different error messages depending on if "As Excel.Workbook" is included or not
TemplateBk = fTemplateBk
End Property
':::::::::::::::::::::::::::
'::
':: methods
Public Sub openTemplate()
Set fTemplateBk = Excel.Workbooks.Open("\\xxx\yyy\zzz.xlsx")
End Sub
Public Sub someMethod()
Me.TemplateBk.Sheets(1).Activate
End Sub
Normal module:
Sub control()
Dim x As clXXX
Set x = New clXXX
x.openTemplate
x.someMethod '<<<<<<errors here
End Sub
I want to only access the private field fTemplateBk
via the read-only property TemplateBk
using code such as me.TemplateBk. ...
. How do I amend the above so this is possible?