Skip to content

Commit e680444

Browse files
committed
Using xlam
1 parent 39e0751 commit e680444

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

Installer.bas

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ strPathOfBuild = CurrentWB.Path & "\src\vbaDeveloper.xlam\Build.bas"
156156
NewWB.VBProject.VBComponents.Import strPathOfBuild
157157

158158
'Rename the project (in the VBA) to vbaDeveloper
159-
NewWB.VBProject.Name = TOOL_NAME & "_pkg"
159+
NewWB.VBProject.Name = TOOL_NAME
160160

161161
'Add references to the library
162162
'Microsoft Scripting Runtime
@@ -165,15 +165,30 @@ NewWB.VBProject.VBComponents.Import strPathOfBuild
165165
'Microsoft Visual Basic for Applications Extensibility 5.3
166166
NewWB.VBProject.References.AddFromGuid "{0002E157-0000-0000-C000-000000000046}", 5, 3
167167

168-
'Save file as .xlsm
168+
'In VB Editor, press F4, then under Microsoft Excel Objects, select ThisWorkbook.Set the property 'IsAddin' to TRUE
169+
NewWB.IsAddin = True
170+
'In VB Editor, menu File-->Save Book1; Save as vbaDeveloper.xlam in the same directory as 'src'
171+
172+
'Save file as .xlam
169173
strLocationXLAM = CurrentWB.Path
170-
NewWB.SaveAs strLocationXLAM & "\" & TOOL_NAME & "_pkg" & ".xlsm", xlOpenXMLWorkbookMacroEnabled
171-
172-
'Close excel. Open excel with a new workbook, then open the just saved vbaDeveloper.xlsm
174+
Application.DisplayAlerts = False
175+
NewWB.SaveAs strLocationXLAM & "\" & TOOL_NAME & ".xlam", xlOpenXMLAddIn
176+
Application.DisplayAlerts = True
177+
178+
'Close and reopen the file
173179
NewWB.Close savechanges:=False
180+
Set NewWB = Workbooks.Open(strLocationXLAM & "\" & TOOL_NAME & ".xlam")
181+
182+
Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 5)
174183

175184
'Run the Build macro in vbaDeveloper
176-
Application.Run "vbaDeveloper.xlsm!Build.testImport"
185+
Application.OnTime Now + TimeValue("00:00:05"), "vbaDeveloper.xlam!Build.testImport"
186+
Application.OnTime Now + TimeValue("00:00:12"), "installer.xls!SaveFile"
177187

178188
End Sub
179189

190+
Sub SaveFile()
191+
Workbooks("vbaDeveloper.xlam").Save
192+
ThisWorkbook.Saved = True
193+
Application.Quit
194+
End Sub

Installer.xls

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)