Solved

VBA/VSTO Fire VB.net code using VBA

Posted on 2013-01-25
2
372 Views
Last Modified: 2013-01-29
Hi

I have a VB.net Add-in  that is open at the same time as an Excel file containing macros. I need to run code in VBA to open a form on the VB.net side. What clever way can this be done by firing an event in VBA that the VB.net side picks up in order to run it's code.
0
Comment
Question by:murbro
2 Comments
 
LVL 11

Accepted Solution

by:
jkpieterse earned 500 total points
ID: 38818340
One way is to have the .NET addin create a (hidden) commandbar with a button. You can then use the commandbarbuttons's execute method to start code in the .NET addin.

Here is some code I used for an add-in I have:

Public Sub LaunchPrecedents()
    Dim octl As CommandBarControl
    For Each octl In Application.CommandBars("Cell").Controls
        If octl.Tag = "RefTreeAnalyser" Then
            octl.Controls(1).Execute
        End If
    Next
End Sub
0
 

Author Closing Comment

by:murbro
ID: 38831374
Thanks very much
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now