Solved

VB.net Excel Add-in - call three toggle button clicks at once

Posted on 2012-04-09
6
484 Views
Last Modified: 2012-06-21
Hi. Below is the code behind three toggle button clicks on my Excel Add-In VB.net.
Each opens a CustomTaskPane. What code would I use to make all three happens simyltaneously behind a further ribbon button


    Private Sub ToggleButton1_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles ToggleButton1.Click
        Globals.ThisAddIn.Where_TaskPane.Visible = _
    TryCast(sender, Microsoft.Office.Tools.Ribbon.RibbonToggleButton).Checked

    End Sub

    Private Sub ToggleButton__FROM_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles ToggleButton__FROM.Click
        Globals.ThisAddIn.From_TaskPane.Visible = _
    TryCast(sender, Microsoft.Office.Tools.Ribbon.RibbonToggleButton).Checked
    End Sub

    Private Sub ToggleButton_SELECT_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles ToggleButton_SELECT.Click
        Globals.ThisAddIn.Select_TaskPane.Visible = _
TryCast(sender, Microsoft.Office.Tools.Ribbon.RibbonToggleButton).Checked
    End Sub
0
Comment
Question by:Murray Brown
[X]
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
  • 3
  • 2
6 Comments
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 37826323
One possible solution:
Private Sub CommonButton_SELECT_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles ToggleButton_SELECT.Click
        ToggleButton1_Click( Button1, e)
        ToggleButton__FROM_Click(Button__FROM, e)
        ToggleButton_SELECT_Click(Button_SELECT , e)
    End Sub

Where Button1, Button__FROM and Button_SELECT are the instance of your buttons defined on your ribbon.

Note: Next time include the VSTO zone in your question, all Add-ins build with VS uses the VSTO technology and Interop.
0
 

Author Comment

by:Murray Brown
ID: 37826411
Hi

I get the following errors. Also the VSTO zone does not come up if you search for VSTO.1
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 37830360
Where are your buttons defined?
Can you provide your source code of the the ribbon and Add-in regarding the 3 buttons?
All you need to do is get a reference to the buttons - Most likely the ribbon button scopes are private , you need to make them public or create a public property for every button, so that you can access them from your ThisAddin.vb source code?)
Note: I do not have all your source code and do not know how you implement the buttons. I provide guidelines for the posted info only.
0
 

Author Comment

by:Murray Brown
ID: 37831517
Hi

I worked it out myself. All that was needed was what I provided. Thanks
        Globals.ThisAddIn.From_TaskPane.Visible = True
        Me.ToggleButton__FROM.Checked = True
        Globals.ThisAddIn.Select_TaskPane.Visible = True
        Me.ToggleButton_SELECT.Checked = True
        Globals.ThisAddIn.Where_TaskPane.Visible = True
        Me.ToggleButton1.Checked = True
0
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 37835164
Good, please delete this question.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

623 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