Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Excel VBA Running a hidden CommandBar created in Excel VB.net Add-in

Posted on 2013-01-29
6
309 Views
Last Modified: 2013-02-08
Hi, I ran  the following code in my .NET addin create a (hidden) commandbar with a button. What VBA code do I write to use the commandbarbuttons's execute method to start code in the .NET addin.

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
Comment
Question by:murbro
  • 3
  • 3
6 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38831769
The above code is for executing not creating the commandbar. Does it not work?
0
 

Author Comment

by:murbro
ID: 38858525
Hi. Sorry about late reply. What code would I use to create the commandbar? Thanks
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38859018
I thought you already have created the commandbar.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:murbro
ID: 38860234
All I saw was the code above, whilst searching through Google
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 38863480
Sorry I am confused. Your question is

>Excel VBA Running a hidden CommandBar created in Excel VB.net Add-in

so my assumption was you have created a hidden commandbar and need code to execute it. Is the question now

>Excel VBA Creating and Running a hidden CommandBar created in Excel VB.net Add-in

if so check following

http://msdn.microsoft.com/en-us/library/office/aa165073(v=office.10).aspx

There should be a .visible property which you can set to false.

For executing it, the code you have should work.
0
 

Author Closing Comment

by:murbro
ID: 38867470
Thanks very much. The question was confusing. I appreciate the advice
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

861 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