none
Repurpose Word button callback problem in C++/ATL RRS feed

  • Question

  • I followed this document http://msdn.microsoft.com/en-us/library/office/bb462633(v=office.12).aspx on repurposing Word buttons and was able to successfully do so in a VSTO c# project.

    I'm trying to work this into a legacy word plugin project written in C++/ALT.

    For the ribbon xml I have:

    <command idMso='Cut' onAction='MyOnAction'/>

    in the IDL  I have:

    [id(1), helpstring("method MyOnAction")] HRESULT MyOnAction([in] IDispatch* pRibbonCtrl, [in,out] VARIANT_BOOL *fCancelDefault);

    and in Connect.cpp I have

    STDMETHODIMP CConnect::MyOnAction(IDispatch* pRibbonCtrl, VARIANT_BOOL* bRet)
    {
    MessageBox(NULL,"I'm here!","APP",MB_OK);
    *bRet = VARIANT_FALSE;
    return S_OK;

    I never actually see the message box when Bold is clicked. In addition, the selected text does NOT  become Bold either (no error reported)

    I searched online and found a few discussions dating back to 2010, claiming that the callback for onAction signature is actually incorrect (http://www.office-outlook.com/outlook-forum/index.php/t/214992/) and should be:

    STDMETHODIMP CConnect::MyOnAction(IDispatch* pRibbonCtrl, VARIANT* bRet)

    I tried this too but observed the same behavior. 

    Any help would be appreciated!

    Friday, March 15, 2013 7:57 AM

All replies

  • Hi Epochdave,

    Thank you for posting in the MSDN Forum.

    I'll consult your issue with my colleague. You'll be informed if there's any update.

    Thank you for your patience and understanding.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 18, 2013 6:18 AM
    Moderator
  • Hi epochdave,

    I tested this but I was also unable to get it to work.  If nobody else in the community has any suggestions, the only thing I can suggest is to open up a support case with us to we can investigate further.  Sorry I couldn't help!


    Sharon M, Microsoft Online Community Support

    Friday, March 29, 2013 2:11 PM