Want to display notification in Task pane in Word using VBA - 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.

Related

Purge an IMAP folder in Outlook 2016 using VBA

In Outlook 2016 I have connected an IMAP folder. Outlook is configured to mark items as deleted in IMAP folders. This is necessary because I want to process those items, that are marked for deletion seperately. After my macro is completed, that IMAP folder should be purged automatically.
In Outlook there is the ribbon "Folder" with the group "purge". In there is the menu "delete" with an menu item to purge the current folder. I can't find a way to execute the function from a VBA macro.
For Outlook 2010 there is this solution:
http://www.vboffice.net/en/developers/purge-deleted-imap-messages/
In Outlook 2016, the findControl method does not find the required control.
Is there any way to purge that folder?
Best solution would be some kind of API function.
Second best would be to simulate a click event on the control of the ribbon. "CommandBars" seems to contain some sort of context menus but not the ribbon controls.
Is it possible to define custom commandbars with standard controls in it? The control id seams to be still "12771".
I very briefly looked into the UI Automation toolkit but have found no good example of how to access the ribbon of a specific application.
Alternatively: can I get access to controls of the quick access toolbar? Adding the correct purge folder control to the quick access toolbar would rely on the user to click on that button at the right moment.
For buttons you can add to a ribbon or the QAT, the idMso can be seen at the end of the text when hovering over the command.
Sub PurgeFolder_Button_idMso()
' For buttons you can add to a ribbon or the QAT,
' the idMso can be seen at the end of the text when hovering over the command.
ActiveExplorer.CommandBars.ExecuteMso ("PurgeFolder")
End Sub

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

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.

is it possible to add a button to the right-click context menu for a user in Outlook 2010 using VBA?

I've tried many things and read up quite a bit but I cannot figure this out.
I cannot create an add-in so I have to use VBA.
I want to add a a button to the right-click context menu when I right-click on a user. Is this possible?
Yes, it is possible to customize the context menu in Outlook. See Customizing Context Menus in Office 2010 for more information.
But VBA doesn't allow to customize the Fluent UI in Outlook, you need to develop an add-in instead.

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.

make collapsible custom task panes in outlook?

Is it possible to make collapsible task panes in outlook. ie. Can I have a button on lets say a ribbon that upon clicking can either make the pane appear, or if it is already open make is collapse or disappear? Everything I've been able to find related to this involves add-in express, which I do not have. Any help or leads would be greatly appreciated.
Add-In Express is not required to show or hide a custom task pane. You can toggle the Custom Task Pane visibility by using the TaskPane.Visible property.
customTaskPane.Visible = false; // hides task pane from view
See Custom Task Panes on MSDN for further reference, specifically the section "Modifying the Appearance of the Task Pane"