XLL Functions

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

XLL Functions
Write to cells from XLL without COM 
Subscribe
Michael Kaden




Posts: 24
Joined: 2023-10-25
Hello Andrei,

my current software combines XLL and COM AdddIn's and I use:

Call AddinModule.CurrentInstance.DoSendMess(SMSTR)

to put all the calculations in a "calculation tree" and then do the work in the COM AddIN and write the results to cells.

Is there any way to avoid that and the XLL function writes results directly to cells using "offset"

Thank you very much and kind regards

Michael
Posted 04 Jun, 2026 12:11:22 Top
Andrei Smolin


Add-in Express team


Posts: 19223
Joined: 2006-05-11
Hello Michael,

For XLL add-ins it isn't possible; it is only possible for Excel Automation add-ins. An Excel Automation add-in is COM based and it executes in the same context as your COM add-in; an XLL is invoked in a different context, where COM may not be available; this is why you have to use the SendMessage/OnSendMessage mechanism with your XLL: it creates a small delay to let Excel switche to the COM context.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Jun, 2026 07:30:42 Top
Michael Kaden




Posts: 24
Joined: 2023-10-25
Thank you very much Andrei if I understand it right, if I want Excel behavior i.e. on cell input by the user the calculation should start but the calculation should then also modify various cells in the sheet we need the combination of XLL and COM and control them with SendMessage/OnSendMessage? I did that in my previous aleraSoft AddIn and it works well I just wanted to confirm that there is no easier way. Just for your info, on the COM calculation I use
ExcelApp.EnableEvents = False
ExcelApp.ScreenUpdating = False
ExcelApp.Calculation = XlCalculation.xlCalculationManual
COM Code………
ExcelApp.Calculation = XlCalculation.xlCalculationAutomatic
ExcelApp.ScreenUpdating = True
ExcelApp.EnableEvents = True
Because the COM code writes to cells which are variables in the XLL function and to avoid a recalculation on each single value input by the COM
I also use
SyncLock sc.SyncRoot
COM CODE .....
End SyncLock
as I use BackgroundWorker in Th COM code and it happend that teh UI Tread was clear and XLL started even with te COM not finished.
Hope I understood that correctly but it works well
Thank you and kind regards Michael
Posted 08 Jun, 2026 10:20:14 Top
Andrei Smolin


Add-in Express team


Posts: 19223
Joined: 2006-05-11
Hello Michael,

That is, with XLL and COM add-in you can only get this behavior if you use the SendMessage/OnSendMessage machinery. Again, the problem is Excel: it executes your XLL in a context where there's no COM; the delay allows Excel to switch to the COM context.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Jun, 2026 08:31:22 Top