Skip to content

Commit 02cc11a

Browse files
committed
Skip add-in procedure call if add-in is missing
1 parent 3d5a13a commit 02cc11a

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

source/modules/ACLibFileManager.cls

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -452,18 +452,22 @@ End Sub
452452

453453
Private Function TryRunAddInProcedure(ByVal ProcedureCall As String) As Boolean
454454

455-
Dim AddInFilePath As String
455+
Dim AddInFilePath As String
456456

457-
ProcedureCall = Replace(ProcedureCall, "%addins%", Environ$("appdata") & "\Microsoft\AddIns", , , vbTextCompare)
458-
ProcedureCall = Replace(ProcedureCall, "%appdata%", Environ("appdata"), , , vbTextCompare)
457+
ProcedureCall = Replace(ProcedureCall, "%addins%", Environ$("appdata") & "\Microsoft\AddIns", , , vbTextCompare)
458+
ProcedureCall = Replace(ProcedureCall, "%appdata%", Environ("appdata"), , , vbTextCompare)
459459

460-
AddInFilePath = Left(ProcedureCall, InStrRev(ProcedureCall, ".")) & "accda"
461-
If Len(VBA.Dir(AddInFilePath)) = 0 Then
462-
Exit Function
463-
End If
460+
AddInFilePath = Left(ProcedureCall, InStrRev(ProcedureCall, ".")) & "accda"
461+
If Len(VBA.Dir(AddInFilePath)) = 0 Then
462+
If Mid(ProcedureCall, 2, 1) = ":" Then ' is an add-in call, but add-in is not available => ignore it
463+
VBA.MsgBox "Add-in '" & AddInFilePath & "' is not available, procedure call is skipped", vbInformation, "Call procedure skipped"
464+
TryRunAddInProcedure = True
465+
End If
466+
Exit Function
467+
End If
464468

465-
TryRunAddInProcedure = True
466-
CallApplicationRun ProcedureCall
469+
TryRunAddInProcedure = True
470+
CallApplicationRun ProcedureCall
467471

468472
End Function
469473

0 commit comments

Comments
 (0)