Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2017, 11:55 PM
NevilleT NevilleT is offline Modifying the Ribbon in Word 2016 Windows 7 64bit Modifying the Ribbon in Word 2016 Office 2003
Novice
Modifying the Ribbon in Word 2016
 
Join Date: Mar 2015
Posts: 29
NevilleT is on a distinguished road
Default Modifying the Ribbon in Word 2016

I am trying to modify a ribbonon a new macro enabled template I am creating in Word 2016 . I created a new tab and added a number of macro buttons and it is working fine. I just used the customise ribbon option to create the new tab.



I decided the symbols that were available did not work for me so did some digging and found I can create my own images (100x100px) and use them. I need to just replace the images in the xml file.

Now I can start an xml file from scratch and attach it to the template, but since I have about a dozen commands on the tab, thought it would be easier to use an existing xml file for the tab I created. Problem is, I don't know where to get to the xml file I created, or even if there is one.

If I customise the ribbon using the right click command, is an xml file created which I can modify?

I looked at the export option which produced an xml looking file. Dropped it into Custom UI editor for Microsoft Office and it just displays as a bunch of text. Will not parse.

Would appreciate any help on this.
Reply With Quote
  #2  
Old 04-04-2017, 12:44 AM
gmayor's Avatar
gmayor gmayor is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Why not do the job properly - http://gregmaxey.mvps.org/word_tip_p...bbon_main.html ?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 04-04-2017, 03:14 AM
NevilleT NevilleT is offline Modifying the Ribbon in Word 2016 Windows 7 64bit Modifying the Ribbon in Word 2016 Office 2003
Novice
Modifying the Ribbon in Word 2016
 
Join Date: Mar 2015
Posts: 29
NevilleT is on a distinguished road
Default

Hi Greg. Already been to your site and it was the most helpful in understanding the topic. Also read the article on using other symbols. As I said, I could start from scratch but since I have the tab almost complete, was wondering if I can access the xml for what I have done, and modify it from there.

Thanks for a great article.
Reply With Quote
  #4  
Old 04-04-2017, 05:04 AM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I agree with Graham (not Greg) that you would be way ahead of the game doing a custom template.

You would likely want to work with the export file Word Customizations.exportedUI.

The following page may help you understand the xml structure of these.
https://msdn.microsoft.com/en-us/lib...tomizationFile

Notepad is the program I would probably use to try to make changes to these. Keep backups.

The
Custom UI editor only works on docx, docm, dotx, and dotm files for Word.
The XML Notepad program will not read the file.

I do not know of anyone experienced with Office ribbon modification that would recommend bothering with the files generated by the interface, but you are free to do it the hard way.

The thing is, these files are not really appropriate for sharing. When you transfer one to a new computer you overwrite any existing modifications using that file.

Modifying the Ribbon in Microsoft Word
RibbonX: Customizing the Office Ribbon by Robert Martin, Ken Puls, and Teresa Hennig
Reply With Quote
  #5  
Old 04-04-2017, 05:38 AM
NevilleT NevilleT is offline Modifying the Ribbon in Word 2016 Windows 7 64bit Modifying the Ribbon in Word 2016 Office 2003
Novice
Modifying the Ribbon in Word 2016
 
Join Date: Mar 2015
Posts: 29
NevilleT is on a distinguished road
Default

Firstly apologies to Graham. Looked at the website and thought it was Greg.

You have convinced me to go the custom xml route. I thought I could get a start by modifying the xml automatically generated by the ribbon customisation functionality but it seems that has issues.

May come back to the forum if I run into any problems. Will read all the links provided before I start. Thanks guys.
Reply With Quote
  #6  
Old 04-04-2017, 05:47 AM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

You may want to simply add them to the QAT, storing the modifications in the template holding the macros. (It depends on the number of macros.)

It is then relatively easy to use the Notepad or XML Notepad to modify the images and tooltips. in the CustomUI.XML files that you would extract from the template containing your QAT.

Modifying the QAT in Microsoft Word
Modify Quick Access Toolbar (QAT) Button Image or Text

This is a lot easier than creating a custom ribbon from scratch or modifying the export file.

[Edit] I see you are using your own images, that would require a Ribbon customization. OTOH, the number of mso images available is large (much larger than the number available directly through the interface). If you use one of the mso images, you do not need the ribbon customization.

Last edited by Charles Kenyon; 04-04-2017 at 06:14 AM. Reason: Added distinction between custom and mso stock images
Reply With Quote
  #7  
Old 04-04-2017, 06:08 AM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

One further question I have is what these macros are for.

Refugees from Wordperfect land often want to use macros to insert blocks of text. If that is what you are doing, a far better method is to use AutoText and/or AutoCorrect. Automated Boilerplate Using Microsoft Word

AutoText and other building blocks are particularly well-suited for inclusion in a template.
Reply With Quote
  #8  
Old 04-04-2017, 03:55 PM
NevilleT NevilleT is offline Modifying the Ribbon in Word 2016 Windows 7 64bit Modifying the Ribbon in Word 2016 Office 2003
Novice
Modifying the Ribbon in Word 2016
 
Join Date: Mar 2015
Posts: 29
NevilleT is on a distinguished road
Default

Thanks Charles. I am using them to create a specific type of document layout for things like introductions, procedures, definitions, processes etc. Each has a particular layout for tables and formatting. Probably about 15-20 macros at the moment. Need to do things like insert tables within tables so have to have functions that tell me if I am in a table and in the right cell etc.

I am fairly proficient in VBA but worked mainly in Access. Built Access apps for decades. Just getting used to Word objects and how to create a ribbon.

If you use one of the mso images, you do not need the ribbon customization.

I just looked at the mso images available and that might answer the question. The customisation ribbon function is only a small number that did not fit my needs. For example I want different images for insert a 2 col table, 3 col table, 4 col table. Will investigate further.

I enjoy learning about new features so think I will persevere with an xml solution and teach myself how to do it. The links you have provided will keep me busy for the next few days as I put it all together.

Thanks.
Reply With Quote
  #9  
Old 04-05-2017, 04:54 AM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

It looks to me that you would be best off creating templates for at least some of these, perhaps storing them as Workgroup templates.

Another option would be AutoText or Building Blocks. These are very well suited to table layouts.
Automated Boilerplate Using Microsoft Word

Vba programming can be very versatile, but often people are trying to "reinvent the wheel" doing something already done by a Word feature.

Quote:
The links you have provided will keep me busy for the next few days as I put it all together.
Try weeks or months. That is, unless you have substantial vba and xml experience. That may be daunting, but keep slogging at it and you will get it. As Greg says, it isn't rocket science. It does not require real math, just learning a bunch of arcane rules. One of the real crunchers is that xml, unlike vba, is case sensitive.

Finally, before you spend a lot of time on developing these, be sure you have a good grasp of how Styles work.
Understanding Styles in Microsoft Word
Table styles are a separate question, but one that also might be worth your looking into.
Reply With Quote
  #10  
Old 04-21-2017, 04:54 AM
NevilleT NevilleT is offline Modifying the Ribbon in Word 2016 Windows 7 64bit Modifying the Ribbon in Word 2016 Office 2003
Novice
Modifying the Ribbon in Word 2016
 
Join Date: Mar 2015
Posts: 29
NevilleT is on a distinguished road
Default Word Ribbon Macro

Thanks for all those who helped me get into ribbons using xml. Good advice and made much progress. I am enjoying the new learning experience.

My current problem which I have spent a few hours on is how to show the style manager.

Now I know how to use idMsc for a button or togglebutton but am stumped when it comes to a macro. This is what I have.

<button id="Btn34" label="Style Menu" screentip="Styles" bnAction="btnNewStyleSets_Click"/>

Would appreciate any help.
Reply With Quote
  #11  
Old 04-21-2017, 06:43 AM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

First, remember that XML is case sensitive.

Is your macro named "btnNewStyleSets_Click?" That looks like something from a userform or ActiveX.

What problem are you having? Is your button showing up in the Ribbon? Do you click on your button and nothing happens?
Reply With Quote
  #12  
Old 04-21-2017, 07:51 AM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Here is my "go-to" reference:
RibbonX: Customizing the Office Ribbon by Robert Martin, Ken Puls, and Teresa Hennig
Although written for Office 2007, it is still gold.

You need to name your macro as a ribbon control.
i.e. Sub btnNewStyleSets_Click(control As IRibbonControl)

Take a look at my Continuous Page Numbering Add-In which has a single button added to the header tab with an associated macro.
For a different example where none of the macros are triggered directly by Ribbon buttons but rather are triggered through QAT buttons, see Random Text Add-In.
Reply With Quote
  #13  
Old 04-21-2017, 04:55 PM
NevilleT NevilleT is offline Modifying the Ribbon in Word 2016 Windows 7 64bit Modifying the Ribbon in Word 2016 Office 2003
Novice
Modifying the Ribbon in Word 2016
 
Join Date: Mar 2015
Posts: 29
NevilleT is on a distinguished road
Default

Hi Charles. Thanks for responding. Not clear on the answer. Let me explain again.

I look at Style Manager by opening the customise ribbon and looking at all commands. I go down and hovering over the menu item, it tells me it is a macro.

At this point, I am not sure what I do with it. Since it tells me it is btnNewStyleSets_Click, do I have to add that as a sub to my VBA and write some code for it to open the Style Manager panel?

Apologies for asking such basic questions but I have spent a considerable time on Google without success. I did look at your example, but it seems to be a straight forward macro you wrote yourself, and I see how that works. I have a few VBA routines I have written on the toolbar, but cannot work out what I do with an inbuilt macro.

I think I have my head around commands, and running my own VBA routines, but not sure what to do with inbuilt Macros. Also thanks for the book reference.
Reply With Quote
  #14  
Old 04-21-2017, 06:26 PM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

What problem are you having?

Is your button showing up in the Ribbon? Ribbon button or QAT icon? It makes a difference.

Do you click on your button and nothing happens?
Reply With Quote
  #15  
Old 04-21-2017, 06:43 PM
Charles Kenyon Charles Kenyon is offline Modifying the Ribbon in Word 2016 Windows 10 Modifying the Ribbon in Word 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by NevilleT View Post
Hi Charles. Thanks for responding. Not clear on the answer. Let me explain again.

I look at Style Manager by opening the customise ribbon and looking at all commands. I go down and hovering over the menu item, it tells me it is a macro.

At this point, I am not sure what I do with it. Since it tells me it is btnNewStyleSets_Click, do I have to add that as a sub to my VBA and write some code for it to open the Style Manager panel? ***
If you are talking Ribbon Customization, you do NOT want to be messing with the Customize the Ribbon dialog if you want custom images.
Modifying the Ribbon in Microsoft Word
Customize the Ribbon (It doesn't take rocket science)
Below is the dialog you do not want to be using...
00 deleteme 3.png

Working on the XML produced by that dialog is way more trouble than it is worth, if it can even be done.

If you are customizing the QAT, on the other hand, the Customize the QAT dialog may well be the place to start, even if you are going to be modifying the XML directly at a later time.
Below is the similar dialog for modifying the QAT:
00 deleteme 2.png

Modifying the QAT in Microsoft Word


This is a Word command, it is not a macro. You can't modify it, but you can call it.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifying the Ribbon in Word 2016 Visio 2016 diagrams embeded in word 2016 not drawing properly stubbo66 Visio 2 08-24-2016 05:58 PM
Modifying RTF File in MS Word 2007 Nickster Word VBA 2 12-02-2015 11:33 PM
Modifying the Ribbon in Word 2016 Modifying list styles in word dreamz Word 1 06-30-2014 12:03 PM
How to import the customized ribbon to Word without overwriting the existing Ribbon? SharonSh Word VBA 0 09-26-2013 11:47 PM
Modifying the Ribbon in Word 2016 Modifying an existing table in Word janewayb Word Tables 1 04-08-2013 06:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:26 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