Solved

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

Posted on 2012-04-09
6
475 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:murbro
[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:murbro
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:murbro
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
how to make search between pages 17 59
visual studio vb.net windows onkeyup 2 40
vb.net deleting excel sheet in workbook 11 54
Make borderless form movable by user 2 26
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

732 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