Excel throws error 0x800AC472 when instance A is in progress and Instance B is opened

Add-in Express™ Support Service
That's what is more important than anything else

Excel throws error 0x800AC472 when instance A is in progress and Instance B is opened
 
Junior Sousa




Posts: 2
Joined: 2022-05-30
Hi,

I have a add-in for excel that enables a workbook to work based on data that is loaded from external resources, however when I open another instance of excel while my workbook is working immediately the excel throws the error 0x800AC472 and due to this the current process is broken.

Analyzing the issue I realise that the problem happens when the addin is initialized in another any instance of excel, but business that probably must be the root cause because during the initialization the excel build connection with external resource and in addition it create new worksheets that are used during the process.

Given the previous scenario I would like to know if it possible control the initialization of addin based on workbook that is opened on excel, i.e., I need that only a specific workbook load the addin, maybe this is not the best solution but for my business I believe that this can cover my problem of concurrency.
Posted 30 May, 2022 11:08:14 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Junior,

I assume, there's no other Excel instance. Instead, you open another workbook. Is this so? Anyway, 0x800AC472 is thrown if your code accesses some Excel property (or method) which requires that the corresponding window is active while it isn't active in your case. I suggest that you debug your code to find the code line that produces this exception.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 31 May, 2022 04:31:44 Top
Junior Sousa




Posts: 2
Joined: 2022-05-30
These are exceptions:

[CODE]
Erro: System.Runtime.InteropServices.COMException (0x800AC472): Exce?ão de HRESULT: 0x800AC472
em Microsoft.Office.Interop.Excel._Worksheet.Unprotect(Object Password)
[CODE]

[CODE]
Erro: System.Runtime.InteropServices.COMException (0x800AC472): Exce?ão de HRESULT: 0x800AC472
em System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
em Microsoft.Office.Interop.Excel.Range.Find(Object What, Object After, Object LookIn, Object LookAt, Object SearchOrder, XlSearchDirection SearchDirection, Object MatchCase, Object MatchByte, Object SearchFormat)
[CODE]

The problem happens when the sheets are been updating and in parallel another any program such as word, excel, etc ... are opened.

Do you have any ideia about what I doing wrong ?
Posted 01 Jun, 2022 17:09:55 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Junior,

Try to activate the Excel window.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Jun, 2022 03:12:00 Top