Skip to content

Commit 3f1c31d

Browse files
Add test for Public Creatable class instance
This is an undocumented property value that is sometimes used in the wild. Currently when you build from source, PublicCreatable (5) classes are converted to PublicNotCreatable (2). This instancing property can be set in VBA, and we want the imported class to match what was exported. This test currently fails, but will pass when the add-in is updated to support this property.
1 parent 3f01386 commit 3f1c31d

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Testing/Testing.accdb.src/forms/frmMain.cls

+3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ Public Sub cmdRunTests_Click()
111111
strTest = CurrentProject.AllModules("clsPerson").Name
112112
ShowResult "Class Module exists", (strTest = "clsPerson")
113113

114+
strTest = GetVBProjectForCurrentDB.VBComponents("clsPublic").Properties("Instancing")
115+
ShowResult "Class with Public Creatable Instancing", (strTest = "5")
116+
114117

115118
' Database properties
116119
strTest = ""

Testing/Testing.accdb.src/modules/basUtility.bas

+13
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,16 @@ Public Function GetVBProjectForCurrentDB() As VBProject
113113
End If
114114

115115
End Function
116+
117+
118+
'---------------------------------------------------------------------------------------
119+
' Procedure : SetClassInstancing
120+
' Author : Adam Waller
121+
' Date : 11/25/2023
122+
' Purpose : Set the clsPublic class to use Public Creatable instancing.
123+
'---------------------------------------------------------------------------------------
124+
'
125+
Public Sub SetClassInstancing()
126+
Const PublicCreatable = 5
127+
GetVBProjectForCurrentDB.VBComponents("clsPublic").Properties("Instancing") = PublicCreatable
128+
End Sub
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
VERSION 1.0 CLASS
2+
BEGIN
3+
MultiUse = -1 'True
4+
END
5+
Attribute VB_Name = "clsPublic"
6+
Attribute VB_GlobalNameSpace = False
7+
Attribute VB_Creatable = True
8+
Attribute VB_PredeclaredId = False
9+
Attribute VB_Exposed = True
10+
'---------------------------------------------------------------------------------------
11+
' Module : clsPublic
12+
' Author : Adam Waller
13+
' Date : 11/25/2023
14+
' Purpose : This class is set to public creatable instancing.
15+
'---------------------------------------------------------------------------------------
16+
17+
Option Compare Database
18+
Option Explicit
19+
20+
Public MyProperty As String

0 commit comments

Comments
 (0)