I try to replicate the second answer from this question. Here is my code for ThisWorkBook:
Code
Option Explicit
Private Type TView
UserInterFace As UIFrm
Model as UIModel
End Type
Private this As TView
Friend Property Get UserInterFace() As UIFrm
If this.UserInterFace Is Nothing Then
Set this.UserInterFace = New UIFrm
End If
Set UserInterFace = this.UserInterFace
End Property
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not this.UserInterFace Is Nothing Then
Unload this.UserInterFace
Set this.UserInterFace = Nothing
End If
End Sub
This should - according to the answer in the link above - make me able to do this in another module of the same project:
ThisWorkbook.UserInterface.Show
Context
I want to make a modeless Userform where the instance "lives" as long as the Workbook. I have heard that this could cause issues but nothing specific. I want to do this in order to preserve my UIModel.
UIModel
is the Model Class UIFrm
the Modeless UI Userform
Problem
I am not able to access the costum property using ThisWorkBook.UserInterFace
and if I declare the Property Get
as Public I will get a compilation error about: Private Properties not beeing able to be accessed publically.
Is this even possible to have a Property Get inside the ThisWorkbook
-Object ?