How do you add a 'public partial class ThisWorkbook' to a VSTO application in C#? - vsto

I am trying to add an ActionPane to an Excel VSTO Add-in. I need to access the ThisWorkbook.ActionsPane collection to add my action panes.
The Microsoft documentation at:
https://learn.microsoft.com/en-us/visualstudio/vsto/how-to-add-an-actions-pane-to-word-documents-or-excel-workbooks?view=vs-2019
says:
To show the actions pane, add the user control to the Controls
property of the ThisDocument.ActionsPane field (Word) or
ThisWorkbook.ActionsPane field (Excel).
Add the following code to the ThisDocument or ThisWorkbook class as a
class-level declaration (do not add this code to a method).
This implies that I need to add a ThisWorkbook class to the VSTO solution. My questions are:
What base class contains the ActionsPlane collection?
How would I add a class derived from this base class to my VSTO?
Some on-line examples of a ThisWorkbook class contain regions that are designer generated.
My workload includes every VSTO item available. There are no Excel items at all under 'Add New Item' or 'Add New User Control' in Visual Studio 2019. Beyond the Ribbon Bar, there are no designers for VSTO.
The only way that I see to do this is to add a ThisWorkbook class manually.
Am I correct in saying that any designers that may have existed in previous versions of Visual Studio, no longer exist in Visual Studio 2019?

You need to differentiate document-level and application-level add-ins.
An actions pane is a customizable Document Actions task pane that is attached to a specific Microsoft Office Word document or Microsoft Office Excel workbook. The actions pane is hosted inside the Office task pane along with other built-in task panes, such as the XML Source task pane in Excel or the Styles and Formatting task pane in Word. You can use Windows Forms controls or WPF controls to design the actions pane user interface.
Read more about Actions panes in the How to: Add an Actions Pane to Word Documents or Excel Workbooks article if you are developing a document-level add-in.
If you are developing an application-level add-in you may be interested in using Custom task panes. Task panes are user interface panels that are typically docked to one side of a window in a Microsoft Office application. Custom task panes give you a way to create your own task pane and provide users with a familiar interface to access your solution's features. For example, the interface can contain controls that run code to modify documents or display data from a data source. See Walkthrough: Automate an application from a custom task pane to get started quickly.

Related

Want to display notification in Task pane in Word using VBA

I have coded a VBA macro that notifies me whenever a new comment has been added to a document using a MsgBox.
I now require that no notification should be in the form of a MsgBox but are displayed in a task pane by clicking on the custom button(Comment Notifier) on the ribbon of word.
Can you suggest me way to do this?
First of all, you need to migrate your existing VBA solution to the add-in rails. There is no way to create a task pane from VBA. The Walkthrough: Create your first VSTO Add-in for Word article explains how to get started quickly. After adding all event handlers to the add-in you may add a task pane to the add-in project, see How to: Add a custom task pane to an application for more information.
Finally, the Walkthrough: Synchronize a custom task pane with a Ribbon button explains how to automate a task pane by clicking on the ribbon button, so you just need to replace the source code a bit and display a notification on the task pane instead.

How to create a Outlook 2013 Add-in Command?

I want to create a Ribbon Button in the calendar view of Outlook that extracts some properties (e.g. data, time) of the current selected calendar item (appointment) in the Outlook calendar view and that creates a new Email with the properties listed in the text.
I also appreciate answers that will provide links to blogs, articles or videos related to this task, as I couldn't find much with the necessary guidance and explanation I need for this. Also other solutions to do this with Outlook on-board tools are welcome. Important: I do not just want to forward the appointment as an attachment to a new Email, I want the properties as text in the Email.
Remarks:
I have no background in MS Office plugin development, please consider this
I have successfully done this walktrough with the VBA code samples (https://msdn.microsoft.com/en-us/library/cc668191.aspx), that adds some text to every new Email message, but I couldn't figure out how to go on effectively to get my task done
Thanks
VBA doesn't allow creating a ribbon custom UI for Outlook. You need to develop a COM add-in for Outlook if you want to create a custom UI. Read more about that in the Walkthrough: Creating Your First VSTO Add-In for Outlook article.
VSTO provides two main ways for creating a custom ribbon UI:
Walkthrough: Creating a Custom Tab by Using Ribbon XML
Walkthrough: Creating a Custom Tab by Using the Ribbon Designer
You may find the Fluent UI described in depth in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
Also, you may consider creating web-based add-ins (former known as Mail Aps), see Add-in commands for Outlook for more information.

How to automatically add a button to a ribbon in Excel 2010

Is it possible to automatically add a button to Excel Ribbon to run a macro when a user open an Excel file. Problem is I have developed a macro and would like to share it with my group members. Now on my personal computer I could customize the ribbon and assign a given button to my macro but this ribbon customization will only be available for me. So after I send out the workbook to members of my group, they will not see the button that I have assigned for the macro. I could add an ActiveX control but this will be on the sheet itself and not on the ribbon (Excel 2010)
Is there a way to do this, without having each member customize his/her ribbon.
Thanks!
I think that you are talking about VSTO, which is the add-ins framework of MS Office, and normally, you need the VS Studio, not Express, to develop your add-ins application.
And at first, you can go to http://msdn.microsoft.com/en-us/library/bb410115%28v=office.12%29.aspx to read the simple guide about the Ribbon button integration, and about other integration way and method, you can read the MSDN directly.
And of course, as a professional VSTO developer, if need, I can help you too. :)

MS Project COM: Click on a Ribbon UI button using COM

I have 2 different .NET projects:
1) MS Project 2010 VSTO project: This project adds a custom ribbon (using XML) to MS Project's ribbon UI. There is a button on this custom ribbon (called "Push_changes"). This project has been packaged into a "VSTO package" and installed on my local machine.
2) I have another .NET console application that has a reference to MS Project Object Library (COM object). Using COM, I am able to start a new instance of MS Project 2010. As a next step, I want to be able to get to the Ribbon (specifically the one that I added in Step 1, using the VSTO project). I then want to get to the "Push_changes" button and click on it (through code).
Now I tried, going through the CommandBars collection, but it doesn't seem to contain anything related to "Ribbon". Enumerating through the CommandBars collection, I can see that there is a CommandBar called "Ribbon", but it says that it has "0" controls on it.
Any help would be appreciated
Assembly which implements Add-on with a ribbon contains a COM Visible class inherited from Microsoft.Office.Core.IRibbonExtensibility.
One of public methods from that class implements that onClick action.
You can access collection of COM Add-Ons through Application.COMAddIns and access that Add-In by name.

Excel VBA: How to turn code into a full on toolbar tool? [duplicate]

I am in the process of creating a VBA add-in for Excel 2010, and I used the "Custom UI Editor for Microsoft Office" tool to create my own ribbon.
However, I would like to give the user the option to load my add-in without displaying the ribbon, or with different parts of the ribbon visible.
With menus, I know you can completely control them programmatically, but ribbons seem to work differently.
Is there a way in VBA to not load my customUI.xml ribbon tabs on startup?
Is there a way to remove items from (or add items to) these tabs at runtime?
here is a whole slew of help on this subject Awesome Ribbon Help. I think points 2 and 3 are of particular interest to you.