at the end of install, Excel crashes - Advanced Installer Community
toosensitive
Posts: 30
Joined: Wed Dec 07, 2011 8:27 pm

at the end of install, Excel crashes

Excel AddIn, .NET 4.0, NetOffice 1.5.1.2, ExcelDNA 1.29, C#
I am using Advanced Installer 9.0.1,

One custom action calls install.xls
installers calls a xls (install.xls) with VBA as follow
At the end of install.xls, Excel will close.
However, after Excel closes, Excel crashes saying
"Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience...."
with two buttons "Send Error Report" or "Don't Send"

This ONLY happens on Windows XP + Excel 2007 or WinXP + Excel 2010.
Also during debug I notice if I replace Application.Wait with MsgBox, then there is no crashes issue at all. I feel there is some kind of timing issue but really has no clue no control.
The issue drives me crazy. Please help. thanks!

(install log attached, and aip project attached. Thanks a lot!)

Private Sub Workbook_Open()

Dim quit As Integer
Dim added As Boolean
added = Add_Addin
Application.Wait (Now + TimeValue("0:00:02"))
If Workbooks.Count = 1 Then
Application.Wait Now + TimeValue("0:00:03")
Application.quit
Else
Application.Wait Now + TimeValue("0:00:03")
Me.Close
End If

End Sub


Private Function Add_Addin() As Boolean
On Error GoTo ERR_

Dim addinFile As String

addinFile = ThisWorkbook.Path & "\" & "MyAdd-In.xll"

If Len(addinFile) > 0 Then
Dim LEA As AddIn
Set LEA = Application.AddIns.Add(addinFile)
If (Not LEA Is Nothing) Then
LEA.Installed = True
Else
MsgBox "Failed to add XLL"
End If

'If (Application.RegisterXLL(addinFile) = True) Then
' MsgBox "Yeah, succeed registering XLL"
'Else
' MsgBox "Failed to register XLL"
'End If

Else
MsgBox "XLL file not found"
End If

addinFile = ThisWorkbook.Path & "\" & "MyFunc.xla"
If Len(addinFile) > 0 Then
Dim LEA2 As AddIn
Set LEA2 = Application.AddIns.Add(addinFile)
If (Not LEA2 Is Nothing) Then
LEA2.Installed = True
Else
MsgBox "Failed to add xla"
End If
Else
MsgBox "xla file not found"
End If

Add_Addin = True

Exit Function

ERR_:
MsgBox ("Error " & Err.Number & " " & Err.Description)
Add_Addin = False

End Function
Attachments
AddIn2003.aip
(67.41 KiB) Downloaded 417 times
install.log
(481.23 KiB) Downloaded 351 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: at the end of install, Excel crashes

Hello,

I'm not sure why this happens. Can you run the related custom action as deferred with no impersonation after "Install Execution Stage -> Add Resources" action group and see if the behavior still persist? Also, can you try to manually run the related custom action and see if everything works?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”