Share via

VSTO Excel Document-Level Customization not Loading

Jack Davids 5 Reputation points
2024-01-09T12:36:50.1733333+00:00

Hi,

I'm working with an Excel document-level customization that suddenly stopped working. Below some of the symptoms:

  • In ThisWorkbook, event Me.Startup is not running.
  • In the customization's ribbon, event MyBase.Load is not running.

Similar events in an Excel add-in are working as expected.

Below the development environment:

  • Windows 11 Enterprise 64 bits
  • Office 365 Version 2302 Build 16.0.16130.20848 64 bits
  • .NET Framework 4.7.2

Below the ThisWorkbook code:

Public Class ThisWorkbook
	Private Sub ThisWorkbook_Startup() Handles Me.Startup
          Try
             MessageBox.Show("Hi!")
         Catch ex As Exception
             MessageBox.Show(ex.Message)
         End Try
	End Sub

	Private Sub ThisWorkbook_Shutdown() Handles Me.Shutdown
	End Sub

End Class 

Below the ribbon code:

Imports Microsoft.Office.Tools.Ribbon
Public Class DemoRibbon

	Private Sub DemoRibbon_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
          Try
             Dim x As Integer = 1 + 2
         Catch ex As Exception
             MessageBox.Show(ex.Message)
         End Try
    End Sub

    Private Sub DemoButton_Click(sender As Object, e As RibbonControlEventArgs) Handles DemoButton.Click
          MessageBox.Show("Hi!")
    End Sub

End Class
Microsoft 365 and Office | Development | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. Rodrigo Texeira 0 Reputation points
    2024-02-08T19:26:48.8+00:00

    I had the same issue, please check with your admin team the setting:
    Policies > Administrative Templates > Microsoft Office 2016/Security Settings > "Prevent Word and Excel from loading managed code extensions" - ENABLED I asume that you could find the corresponding Windows registry that manage it too, if you dont have access to GPOs

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.