Programmatically configure Word 2010 Office Ribbon through VBA

Can I customize the ribbon (for example, add a tab, etc.) in Office 2010 programmatically through VBA? That is, by writing VBScript code in a macro.

Br. Morten

+4
source share
3 answers

You can control the Ribbon tab and its controls using VBA, but you cannot create it. In any case, not with the object model. The best thing you could do - somehow - get some kind of OPC-dll (e.g. ActiveX component) that handles opening / relationships / closing OPC documents (e.g. docx documents) and the old MSXML school to create the definition tape and add it to the package.

+3
source

If your user interface is static, i.e. you do not need to programmatically change the behavior or add / remove user interface elements "on the fly", you can define customUI in a template with macro support. You can use your VBA functions as callbacks for interface elements defined in XML.

Check out this guide . In a nutshell, you define the customUI\customUI14.xml in the .dotm archive. This XML describes your custom feed elements using this schema .

This definitely works for Word templates (.dotm files). I think a similar approach works for any OOXML format.

+1
source

Source: https://habr.com/ru/post/1344921/


All Articles