none
Different Word templates A and B have same module names. Template A module code is always code RRS feed

  • Question

  • I have two Word global templates located in

    C:\Program Files (x86)\Microsoft Office\Office15\STARTUP

    P.dotm

    W.dotm

    To create ribbons on the templates I’ve used the utility Custom UI Editor for Microsoft Office. 

    To run the ribbons I’ve created a module. Each template has the same module name and same  sub name eg

    Module1

    Public Sub Callback(control As IRibbonControl)

    < buttons pressed code here>

    .......

    The issue

    In Word

    for Template W.dotm ribbons when I click on the buttons, the result  P.dotm code runs

    It seems the alphabetical P.dotm code runs first.

    How can I rename the code to get the correct ribbon code to run for the specific template

    TIA


    • Edited by dd_ Thursday, May 17, 2018 2:37 AM
    Thursday, May 17, 2018 2:36 AM

Answers

  • Hello dd_,

    I'm glad to hear that your issue has been resolved. I would suggest you mark helpful reply to close the thread.

    If you have any other issue, please feel free to post threads to let us know.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by dd_ Monday, May 21, 2018 2:08 AM
    Friday, May 18, 2018 5:49 AM

All replies

  • Hello dd_,

    Callback function's function name could be customized. So a quick solution is to change one of the Callback name, such as "CallbackInP", so the control could use an unique callback name to get correct callback function.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 18, 2018 2:09 AM
  • Many thanks Terry

    I'll give that ago

    --dd

    Friday, May 18, 2018 2:50 AM
  • Hello Terry

    The results were

    For template W.dotm I updated the Callback name to

    Public Sub CallbackW(control As IRibbonControl)

    For template P.dotm I updated the Callback name to

    Public Sub CallbackP(control As IRibbonControl)

    The results in Word, when I click on the ribbon buttons the results errors as doesn't recognise or know about the Sub name change.

    I used the utility Custom UI Editor for Microsoft Office to create the ribbons, so perhaps it 'stamps' with a standard name of Public Sub Callback(control As IRibbonControl)

    Friday, May 18, 2018 4:41 AM
  • Hello dd_,

    In custom ui eidtor, change onAction function to the function you renamed.

    Such as 

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, May 18, 2018 5:23 AM
  • nice one Terry that worked

    Many thanks again :)

    Friday, May 18, 2018 5:41 AM
  • Hello dd_,

    I'm glad to hear that your issue has been resolved. I would suggest you mark helpful reply to close the thread.

    If you have any other issue, please feel free to post threads to let us know.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by dd_ Monday, May 21, 2018 2:08 AM
    Friday, May 18, 2018 5:49 AM