.NET VSTO - Excel ribbon ribbon tab tab is empty, but only on the first instance of Excel

So, I'm an experienced VSTO developer, but I have a new problem with one of my add-ons. The add-in installs and works very well, but for some reason, when the first Excel instance is open (like there are currently no other workbooks currently open), the add-in ribbon tab label is empty (see below).


enter image description here


To be clear, this problem only appears in the first instance of Excel. If I open another book with Ctrl+N or File-->New , the shortcut is displayed perfectly in the new book (although the first book will still contain an empty label). In addition, before anyone asks, the ribbon tab type is set to User , not Office .

To make matters worse, I cannot reproduce the problem on my computer, only on client computers. Has anyone seen or heard of this issue before? If so, the link would help a lot.


UPDATE

So, I solved the problem, but I'm still not 100% sure. An error occurred in the feed loading event, due to which I coped poorly, and somehow shortened the shortcut. I made some changes to the handling of this error (and also fixed the error), and now the label is displayed correctly.


OTHER UPDATE

The problem has returned. Any ideas? I will add generosity to encouragement.

+5
source share
4 answers

Perhaps the problem you described is caused by the boot order of VSTO add-ins on client computers. I saw ridiculous problems before the Excel add-in, while loading it, stepped on the next one after it. This explains why you cannot recreate the problem on your computer (different add-ons and / or the load order of add-ons), and why the second sheet did not show this problem (add-in add-on is already loaded and without creating a process that blocks the display of your first text on the add-in ribbon )

Here are a few things you can try:

  • Calling the Invalidate method during the Workbook.New event to find out if the feed updates after loading all add-ons resolves the problem.

    IRibbonUI.Invalidate

    Workbook.New Event

    Alternatively, if the above does not work, it may be interesting to see immediately closes the original empty book, opening a new empty book at the first start, redrawing the label.

  • Change the boot order on client computers by changing the add-in to the on-demand download, and then creating a second add-in that calls your add-in after it loads (thus eliminating possible interference from another process).

    Change the load order of COM add-ins in Excel

+1
source

Here is how I solved this problem:

  • Exit Excel
  • Set LoadBehavior to 16 (first load, then load on demand) in HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\MyExcelAddIn
  • Delete %LocalAppData%\Microsoft\Office\Excel*.customUI file (s) as indicated in Where is the cached VSTO tape cached?
  • Restart excel
+1
source

I do not think this is a setup problem in Excel. Sometimes such bad behavior can be smoked out by some household.

Scan all protected system files and replace the damaged files with a cached copy located in the compressed folder in the% WinDir% \ System32 \ dllcache folder. This may take some time, do not interrupt it. Close as many things as possible with advanced degrees:

 sfc /scannow 

If it is a corporate machine, make sure that you are on the corporate network (if necessary, a VPN). Then run:

 gpupdate /force 

Install the update server on the one that updates and updates office applications.

 Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false 

Launch Windows Updates, Complete Shutdown, Launch Buttons. See if the problem persists. Also consider starting Ccleaner.

0
source

I know this question is a little older, but it can help others (like me) who have struggled with this problem until today. I solved this problem by adding the following code to the STARTUP event handler of my Addin class:

 private void ThisAddIn_Startup(object sender, System.EventArgs e) { Globals.Ribbons.MyAddinRibbons.MyMainRibbon.Label = "My Add-in Name"; } 

In my case, the "MyMainRibbon.Label" property still changes while using the add-in, for example, when creating new workbooks, worksheets, etc. But until I turned on this property when starting the add-in, my add-in was always loaded with an empty label on the main ribbon every time Excel was started, and after creating a new workbook (for example), the label was executed. Excel now starts and loads my add-in with the correct label.

0
source

Source: https://habr.com/ru/post/1266614/


All Articles