D
D
Denis2014-11-24 16:22:45
Visual Basic
Denis, 2014-11-24 16:22:45

How to call code from C# in VBA code?

There is a main project = Excel workbook, with lots of macros.
And there was a need to add another macro, but there are not enough VBA capabilities for this.
Does anyone have a practice of calling methods and functions written in C# in VBA code?
As I understand it, it is necessary to create COM objects and somehow pull them up for VBA.
Sample code required.
I tried to do according to the MSDN article and MSDN2 , but got stuck at the stage

set the EnableVbaCallers property of the host element class to True.
I just don't have this one.
Implementation
Set the ReferenceAssemblyFromVbaProject property of any host element class in the project to True. This will embed the customization assembly type library into the assembly and add the type library reference to the VBA project in the document.
also leads to nothing.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Pukhov, 2014-11-25
@Neuroware

What is described in MSDN will work, but as a crutch, you can create an addon project in the studio for any office products, it can look like a tab with buttons that perform various "goodies" with the document / table, in my addon, work with ActiveDirectory is built for example . If the question is related to Excel, I can throw off the source for a look.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question