Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-20-2018, 08:57 AM
ArtKilp ArtKilp is offline Word 2017 + VSTO 2015 events Windows 8 Word 2017 + VSTO 2015 events Office 2016
Novice
Word 2017 + VSTO 2015 events
 
Join Date: Jan 2016
Posts: 18
ArtKilp is on a distinguished road
Default Word 2017 + VSTO 2015 events

Hi,



How do I set up events for Word / C#? That is, something like "display message on double click" is good enough, but I need it to work on any document when this addin is active (not disabled etc.).

I use pretty much everywhere else Interop, but if Tools is required, then Tools is ok too.

I have a start here:
Code:
namespace WordAddIn1
{
    public partial class ThisAddIn
    {
        public event Microsoft.Office.Tools.Word.ClickEventHandler BeforeDoubleClick;

        private void DocumentBeforeDoubleClick()
        {
            Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
            vstoDoc.BeforeDoubleClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeDoubleClick);
        }

        void ThisDocument_BeforeDoubleClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e)
        {
            Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
            System.Windows.Forms.MessageBox.Show(vstoDoc.Name + " was double-clicked.");
        }
//and below is then private void ThisAddIn_Startup etc.
This mixes now things up (document-addin and tools-interop) and that's why it isn't working. But how to fix it?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2017 + VSTO 2015 events word 2015 squares and Border problem M.Hat Word 8 08-07-2018 08:23 AM
Word 2017 + VSTO 2015 events word 2015 menu does not stay open jalea148 Word 6 03-09-2018 04:46 PM
NO contacts after Outlook updated 3-2017 spockmckoy Outlook 0 03-08-2017 07:14 AM
foto kalender 2017 Herman Mirte Publisher 0 12-07-2016 02:26 AM
Word 2017 + VSTO 2015 events Does Word have an "Events log? Balliol Word 1 05-26-2011 12:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft