Exposing Methods to VBA from C# VSTO Add-in

J

james

I've looked at MS's and Whitechapel's code, but I can't seem to get it
right. I was hoping someone could see what I am doing wrong..

----- In the ribbon class:

namespace ARisk_Reporting
{
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IExposedMethods
{
void RefreshAlllPivots(Excel.Workbook wkb);

void RefreshThisPivot(Excel.PivotTable pvt);
}

[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public partial class ARISK_Ribbon : OfficeRibbon, IExposedMethods
{


----- Class includes two public methods:

public void RefreshAlllPivots(Excel.Workbook wkb)
{

public void RefreshThisPivot(Excel.PivotTable pvt)
{


----- ThisAddIn code:

private ARISK_Ribbon ribbon;
protected override object RequestComAddInAutomationService()
{
if (ribbon == null)
{
ribbon = new ARISK_Ribbon();
}
return ribbon;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top