Skip to content

Commit

Permalink
Verify ribbon active state when the add-in loads
Browse files Browse the repository at this point in the history
Ensure that the ribbon is active when installing or activating the add-in. See joyfullservice#451
  • Loading branch information
joyfullservice committed Nov 3, 2023
1 parent c2ffccf commit 2d21eb6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Version Control.accda.src/modules/clsVersionControl.cls
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ End Sub
'
Private Sub Class_Initialize()
SaveState
' When the class is initialized, make sure the ribbon is active (if installed).
' This way if the COM add-in is not active, it will be automatically activated
' when the add-in is opened from the [Database Tools\Add-ins] menu. (See #451)
modCOMAddIn.VerifyRibbon
End Sub


Expand Down
21 changes: 21 additions & 0 deletions Version Control.accda.src/modules/modComAddIn.bas
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ Public Sub VerifyComAddIn()
' Reload the add-in to refresh the ribbon
UnloadAddIn
LoadAddIn
Else
' Verify that the ribbon is active
VerifyRibbon
End If
End If

Expand All @@ -107,6 +110,24 @@ Public Sub ReloadRibbon()
End Sub


'---------------------------------------------------------------------------------------
' Procedure : VerifyRibbon
' Author : Adam Waller
' Date : 11/3/2023
' Purpose : A lightweight function to verify that the ribbon add-in is active.
' : (It may get turned off if Access is opened in administrator mode.)
'---------------------------------------------------------------------------------------
'
Public Sub VerifyRibbon()
Dim objAddIn As COMAddIn
Set objAddIn = GetCOMAddIn
If Not objAddIn Is Nothing Then
' Activate the add-in if it is not currently active
If Not objAddIn.Connect Then objAddIn.Connect = True
End If
End Sub


'---------------------------------------------------------------------------------------
' Procedure : UninstallComAddIn
' Author : Adam Waller
Expand Down

0 comments on commit 2d21eb6

Please sign in to comment.