Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-04-09
6
Medium Priority
?
501 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 2000 total points
ID: 37835164
Good, please delete this question.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

722 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