-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallAddInForm.cls
More file actions
113 lines (87 loc) · 3.04 KB
/
InstallAddInForm.cls
File metadata and controls
113 lines (87 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'---------------------------------------------------------------------------------------
' Form: _codelib.addins.shared.InstallAddInForm
'---------------------------------------------------------------------------------------
'
' Start form to install Access add-in
'
' Author:
' Josef Poetzl
'
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
'<codelib>
' <file>_codelib/addins/shared/InstallAddInForm.frm</file>
' <license>_codelib/license.bas</license>
' <use>_codelib/addins/shared/AddInConfiguration.cls</use>
' <use>_codelib/addins/shared/AddInInstaller.cls</use>
' <use>base/modApplication.bas</use>
' <use>base/modErrorHandler.bas</use>
'</codelib>
'---------------------------------------------------------------------------------------
'
Option Compare Database
Option Explicit
Private m_Configuration As AddInConfiguration
Private Property Get Configuration() As AddInConfiguration
If m_Configuration Is Nothing Then
Set m_Configuration = New AddInConfiguration
End If
Set Configuration = m_Configuration
End Property
Private Sub Form_Load()
With CurrentApplication
Me.lblVersionInfo.Caption = .ApplicationFullName & " " & ChrW(&H2022) & " Version " & CurrentApplication.Version
End With
LoadDataFromConfiguration True
CheckInstalled
End Sub
Private Sub CheckInstalled()
Dim TargetAddInPath As String
With Configuration
If .AddInRegFilePath Like "|ACCDIR\*" Then
With New AddInInstaller
TargetAddInPath = .GetAddInLocation
End With
TargetAddInPath = TargetAddInPath & .FileName
If CurrentDb.Name = TargetAddInPath Then
Me.cbCompileAddIn.Visible = False
Me.cmdInstallAddIn.Visible = False
Me.Caption = "Installed Add-In"
End If
End If
End With
End Sub
Private Sub LoadDataFromConfiguration(ByVal LoadFromFile As Boolean)
If LoadFromFile Then
Configuration.LoadFromCurrentFile
End If
With Configuration
Me.txtFileName.Value = .FileName
Me.txtAppTitle.Value = .AppTitle
Me.txtAddInTitle.Value = .Title
Me.txtAddInAuthor.Value = .Author
Me.txtAddInCompany.Value = .Company
Me.txtAddInComment.Value = .Comments
Me.txtAddInRegPathName.Value = .AddInRegPathName
Me.txtAddInStartFunction.Value = .AddInStartFunction
End With
End Sub
Private Sub cmdInstallAddIn_Click()
Dim Success As Boolean
Dim InstallMsg As String
Me.sysFirst.SetFocus
Me.cmdInstallAddIn.Enabled = False
With New AddInInstaller
Success = .InstallAddIn(m_Configuration, Nz(Me.cbCompileAddIn.Value, False), InstallMsg)
End With
If Len(InstallMsg) > 0 Then
VBA.MsgBox InstallMsg, vbInformation, m_Configuration.AddInRegPathName
End If
If Success Then
Application.Quit
End If
End Sub