ActiveDocument.ContentControlOnExit doesn't work

Discussion in 'Word' started by joycecang, Dec 11, 2018.

  1. joycecang

    joycecang

    Joined:
    Dec 11, 2018
    Messages:
    3
    Likes Received:
    0
    after i operation word's contentcontrol(like refill the control contents),this event will not work,please help,thank you very much
     
    joycecang, Dec 11, 2018
    #1
    1. Advertisements

  2. joycecang

    macropod Microsoft MVP

    Joined:
    Mar 2, 2012
    Messages:
    421
    Likes Received:
    36
    1. Advertisements

  3. joycecang

    joycecang

    Joined:
    Dec 11, 2018
    Messages:
    3
    Likes Received:
    0
    thanks for the reply.my code as below,it's word addin,use vs2010,office2010. when i open to existing documents ,just called A and B.well this time this ContentControlOnExit goes well.After i closed the document A,ContentControlOnExit event will not work in document B:(
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
    Globals.ThisAddIn.Application.DocumentOpen +=new ApplicationEvents4_DocumentOpenEventHandler(Application_DocumentOpen);
    }
    void Application_DocumentOpen(Document doc)
    {
    Globals.ThisAddIn.Application.ActiveDocument.ContentControlOnExit += new DocumentEvents2_ContentControlOnExitEventHandler(ActiveDocument_ContentControlOnExit);
    }
    void ActiveDocument_ContentControlOnExit(Microsoft.Office.Interop.Word.ContentControl currContentControl, ref bool Cancel)
    {
    MessageBox.Show("控件失去焦点");
    }
     
    joycecang, Dec 12, 2018
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...