Skip to content

Commit 0adbb69

Browse files
committed
Add example for invoking add-in procedures via Application.Run
1 parent b0f13be commit 0adbb69

12 files changed

+1179
-0
lines changed

Example/DeclDictTester.accdb.src/dbs-properties.json

Lines changed: 816 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"Info": {
3+
"Class": "clsDbDocument",
4+
"Description": "Database Documents Properties (DAO)"
5+
},
6+
"Items": {
7+
"Databases": {
8+
"SummaryInfo": {
9+
"Title": "Database"
10+
}
11+
}
12+
}
13+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
VERSION 1.0 CLASS
2+
BEGIN
3+
MultiUse = -1 'True
4+
END
5+
Attribute VB_Name = "ClassToTest"
6+
Attribute VB_GlobalNameSpace = False
7+
Attribute VB_Creatable = False
8+
Attribute VB_PredeclaredId = False
9+
Attribute VB_Exposed = False
10+
Option Compare Database
11+
Option Explicit
12+
13+
'---------------
14+
' Class to test
15+
'---------------
16+
17+
Public Property Get Info() As String
18+
19+
Info = "abc"
20+
21+
Dim Abc As String
22+
23+
End Property
24+
25+
Public Function Method1(ByVal X As Long) As Long
26+
27+
X = X + 1
28+
Method1 = X
29+
30+
End Function
31+
32+
Public Function method2a() As Long
33+
34+
Dim X As Long
35+
36+
X = 1 + 1
37+
38+
If X = 2 Then
39+
X = 9
40+
Else
41+
X = 10
42+
End If
43+
44+
method2a = X
45+
46+
Exit Function
47+
48+
X = 5 'This line will never be reached.
49+
50+
End Function
51+
52+
Public Function Method3() As Long
53+
54+
Dim X As Long
55+
56+
57+
End Function
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
VERSION 1.0 CLASS
2+
BEGIN
3+
MultiUse = -1 'True
4+
END
5+
Attribute VB_Name = "DeclarationDictTestCodemodule"
6+
Attribute VB_GlobalNameSpace = False
7+
Attribute VB_Creatable = False
8+
Attribute VB_PredeclaredId = False
9+
Attribute VB_Exposed = False
10+
Option Compare Database
11+
Option Explicit
12+
13+
'AccUnit:TestRelated
14+
15+
'Implements CodeModulGenerator
16+
17+
Dim AccUnitX As Long
18+
Private m_AccUnitInfo As String
19+
Public Field As String
20+
21+
Private Const Const1 As String = "abc"
22+
23+
Private Enum TestEnum: TestEnum_P1 = 2: End Enum
24+
Private Type TestType1
25+
FldA As Long
26+
FldB As String
27+
FldC As Boolean
28+
End Type
29+
30+
Private Enum TestEnum2
31+
TestEnum2_P1 = 2
32+
TestEnum2_P2 = 3
33+
End Enum
34+
35+
Private Type TestType2
36+
Fld2A As Long
37+
Fld2B As String
38+
FldC As Date
39+
End Type
40+
41+
Private WithEvents m_TextBox As TextBox
42+
Attribute m_TextBox.VB_VarHelpID = -1
43+
44+
Public Event RaiseSomething(ByVal EventParam1 As Variant)
45+
46+
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
47+
48+
Private Declare PtrSafe Function CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
49+
(ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long) As Long
50+
51+
Public Event RaiseSomething2(ByVal EventParam1 As Variant, ByVal EventParam2 As Variant)
52+
53+
Private Sub Class_Initialize()
54+
' Dim Class_Initialize_Xyz as String ... ignored!
55+
End Sub
56+
57+
Public Function AccUnitTestFunct(ByVal FuncParam1 As Variant, FuncParam2() As String) As Variant
58+
59+
Dim FuncVar1 As Variant, FuncVar2
60+
Dim FuncVar3() ' _
61+
Dim CommentX as String, CommentY As Long
62+
63+
Dim FuncVar4 As Long: FuncVar4 = 5
64+
65+
Dim Dim1 As Long: Dim Dim2
66+
67+
Dim Counter2 ' _
68+
Public X asString, Y As Long
69+
70+
End Function
71+
72+
Public Sub ProcWith3DeclLines( _
73+
ByVal D3P1 As Variant, _
74+
ByRef D3P2() As String)
75+
'
76+
End Sub
77+
78+
' Declaration of a property procedure in one line:
79+
Friend Property Get Name1() As String: Name1 = "TestName": End Property
80+
81+
Friend Property Let Name2(ByVal NewValue As String)
82+
'
83+
End Property
84+
85+
Friend Property Set PropertySet(ByVal ObjRef As Object)
86+
'
87+
End Property
88+
89+
Private Sub TestMe() ' _
90+
Private Sub ThisIsOnlyAComment(
91+
92+
End Sub
93+
94+
Public Sub VariableParams(ParamArray Args() As Variant)
95+
'
96+
End Sub
97+
98+
Private Static Sub MyStaticSub(Optional ByVal Reset As Boolean = False)
99+
Static Counter2 As Integer
100+
End Sub
101+
102+
103+
Private Function CodeModulGenerator_CreateCodemodule(ByVal ComponentType As VBIDE.vbext_ComponentType, Optional ByVal Name As String = vbNullString) As VBIDE.VBComponent
104+
'
105+
End Function
106+
107+
Private Sub CodeModulGenerator_InsertDeclarationLine(ByVal Code As String)
108+
'
109+
End Sub
110+
111+
Private Sub CodeModulGenerator_RemoveCodemodule()
112+
'
113+
End Sub
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Attribute VB_Name = "Module1"
2+
Option Compare Database
3+
Option Explicit
4+
5+
Private Sub TestInfo()
6+
'
7+
End Sub
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Attribute VB_Name = "_LoadAddIn"
2+
Option Compare Database
3+
Option Explicit
4+
5+
Public Sub LoadAddIn()
6+
7+
'API: RunVcsCheck(Optional ByVal OpenDialogToFixLettercase As Boolean = False)
8+
9+
Dim AddInCallPath As String
10+
AddInCallPath = CurrentProject.Path & "\..\ACLibDeclarationDictCore.RunVcsCheck"
11+
12+
Dim Result As Variant
13+
Result = Application.Run(AddInCallPath, True)
14+
If Result = True Then
15+
Debug.Print "No problems with letter case"
16+
Else
17+
Debug.Print Result
18+
End If
19+
20+
End Sub
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"Info": {
3+
"Class": "clsDbNavPaneGroup",
4+
"Description": "Navigation Pane Custom Groups"
5+
},
6+
"Items": {
7+
"Categories": [
8+
{
9+
"Name": "Custom",
10+
"Flags": 0,
11+
"Position": 2,
12+
"Groups": [
13+
{
14+
"Name": "Custom Group 1",
15+
"Flags": 0,
16+
"Position": 2,
17+
"Objects": [
18+
]
19+
}
20+
]
21+
}
22+
]
23+
}
24+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Info": {
3+
"Class": "clsDbProject",
4+
"Description": "Project"
5+
},
6+
"Items": {
7+
"FileFormat": 12,
8+
"RemovePersonalInformation": false
9+
}
10+
}
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"Info": {
3+
"Class": "clsDbVbeProject",
4+
"Description": "VBE Project"
5+
},
6+
"Items": {
7+
"Name": "TestApp",
8+
"Description": "",
9+
"FileName": "DeclDictTester.accdb",
10+
"HelpFile": "",
11+
"HelpContextId": 0,
12+
"ConditionalCompilationArguments": "",
13+
"Mode": 0,
14+
"Protection": 0,
15+
"Type": 100
16+
}
17+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"Info": {
3+
"Class": "clsDbVbeReference",
4+
"Description": "VBE References"
5+
},
6+
"Items": {
7+
"stdole": {
8+
"GUID": "{00020430-0000-0000-C000-000000000046}",
9+
"Version": "2.0"
10+
},
11+
"DAO": {
12+
"GUID": "{4AC9E1DA-5BAD-4AC7-86E3-24F4CDCECA28}",
13+
"Version": "12.0"
14+
},
15+
"VBIDE": {
16+
"GUID": "{0002E157-0000-0000-C000-000000000046}",
17+
"Version": "5.3"
18+
},
19+
"Scripting": {
20+
"GUID": "{420B2830-E718-11CF-893D-00A0C9054228}",
21+
"Version": "1.0"
22+
},
23+
"Office": {
24+
"GUID": "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}",
25+
"Version": "2.8"
26+
},
27+
"ADODB": {
28+
"GUID": "{2A75196C-D9EB-4129-B803-931327F72D5C}",
29+
"Version": "2.8"
30+
},
31+
"VBScript_RegExp_55": {
32+
"GUID": "{3F4DACA7-160D-11D2-A8E9-00104B365C9F}",
33+
"Version": "5.5"
34+
}
35+
}
36+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"Info": {
3+
"AddinVersion": "4.1.2",
4+
"AccessVersion": "16.0 64-bit"
5+
},
6+
"Options": {
7+
"ExportFolder": "",
8+
"ShowDebug": false,
9+
"UseFastSave": true,
10+
"UseMergeBuild": false,
11+
"UseGitIntegration": false,
12+
"SavePrintVars": true,
13+
"ExportPrintSettings": {
14+
"Orientation": true,
15+
"PaperSize": true,
16+
"Duplex": false,
17+
"PrintQuality": false,
18+
"DisplayFrequency": false,
19+
"Collate": false,
20+
"Resolution": false,
21+
"DisplayFlags": false,
22+
"Color": false,
23+
"Copies": false,
24+
"ICMMethod": false,
25+
"DefaultSource": false,
26+
"Scale": false,
27+
"ICMIntent": false,
28+
"FormName": false,
29+
"PaperLength": false,
30+
"DitherType": false,
31+
"MediaType": false,
32+
"PaperWidth": false,
33+
"TTOption": false
34+
},
35+
"SaveQuerySQL": true,
36+
"FormatSQL": true,
37+
"ForceImportOriginalQuerySQL": false,
38+
"SaveTableSQL": true,
39+
"SplitLayoutFromVBA": true,
40+
"StripPublishOption": true,
41+
"SanitizeColors": 1,
42+
"SanitizeLevel": 2,
43+
"ExtractThemeFiles": false,
44+
"TablesToExportData": {
45+
"USysRegInfo": {
46+
"Format": "Tab Delimited"
47+
},
48+
"USysRibbons": {
49+
"Format": "Tab Delimited"
50+
}
51+
},
52+
"SchemaExports": {
53+
},
54+
"RunBeforeExport": "",
55+
"RunAfterExport": "",
56+
"RunBeforeBuild": "",
57+
"RunAfterBuild": "",
58+
"RunBeforeMerge": "",
59+
"RunAfterMerge": "",
60+
"ShowVCSLegacy": true,
61+
"HashAlgorithm": "SHA256",
62+
"UseShortHash": true,
63+
"BreakOnError": false,
64+
"PreserveRubberDuckID": false
65+
}
66+
}

0 commit comments

Comments
 (0)