It's easy enough to assign a macro to a button on the QAT or the Ribbon in Office 2010. It's also easy to rename the button so created rather than using the default name that is applied, since the default names are long and ugly but if you do rename the button how do you then review which macro is attached to the button?
If choose customise ribbon and then right click on a button with a macro attached to it there's nothing to indicate which macro.
Ken
see which macro is attached to a button
-
- Panoramic Lounger
- Posts: 8163
- Joined: 25 Jan 2010, 09:09
- Location: retirement
-
- Administrator
- Posts: 78416
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: see which macro is attached to a button
This requires rather complicated programming.
A slightly cumbersome but still relatively easy method:
In Windows Explorer, navigate to C:\Users\<username>\AppData\Local\Microsoft\Office. AppData is a hidden folder, so you must show hidden files, folders and drives in order to see it.
This folder contains the ribbon and QAT customizations in the form of XML files.
For the ribbon, they are named Word.officeUI, Excel.officeUI etc., and for the QAT, they are named Word.qat, Excel.qat etc.
You can view these files in any text editor such as Notepad, or in a dedicated XML viewer.
Here is an entry from the file olkexplorer.officeUI on my PC (the ribbon customizations for the main Outlook window):
<mso:button idQ="x1:Project1.StartAttachmentManager_0_253F60" label="Attachment Manager" imageMso="SourceControlCheckOut" onAction="Project1.StartAttachmentManager" visible="true"/>
The onAction: part specifies the macro Project1.StartAttachmentManager.
And here is an entry from the file Word.qat (the QAT customizations for Word):
<mso:button idQ="x1:Table2Lounge_1" visible="true" label="Table 2 Lounge" onAction="Table2Lounge" imageMso="TableSelect"/>
Again, the onAction: part specified the macro, Table2Lounge in this example.
User friendly? Not at all...
A slightly cumbersome but still relatively easy method:
In Windows Explorer, navigate to C:\Users\<username>\AppData\Local\Microsoft\Office. AppData is a hidden folder, so you must show hidden files, folders and drives in order to see it.
This folder contains the ribbon and QAT customizations in the form of XML files.
For the ribbon, they are named Word.officeUI, Excel.officeUI etc., and for the QAT, they are named Word.qat, Excel.qat etc.
You can view these files in any text editor such as Notepad, or in a dedicated XML viewer.
Here is an entry from the file olkexplorer.officeUI on my PC (the ribbon customizations for the main Outlook window):
<mso:button idQ="x1:Project1.StartAttachmentManager_0_253F60" label="Attachment Manager" imageMso="SourceControlCheckOut" onAction="Project1.StartAttachmentManager" visible="true"/>
The onAction: part specifies the macro Project1.StartAttachmentManager.
And here is an entry from the file Word.qat (the QAT customizations for Word):
<mso:button idQ="x1:Table2Lounge_1" visible="true" label="Table 2 Lounge" onAction="Table2Lounge" imageMso="TableSelect"/>
Again, the onAction: part specified the macro, Table2Lounge in this example.
User friendly? Not at all...
Best wishes,
Hans
Hans
-
- Panoramic Lounger
- Posts: 8163
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: see which macro is attached to a button
Ah, so it wasn't me missing something obvious after all.HansV wrote:...User friendly? Not at all...
I can cope through, many thanks.
Ken
PS did you just know this? If not how did you find it? My Googling turned up nothing even close to an answer
-
- Administrator
- Posts: 78416
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: see which macro is attached to a button
I knew (a) that the QAT customizations are stored in a .qat file, and (b) that Office 2007 and later use XML extensively.
So I tried opening a .qat file in Notepad, and bingo! From there, it was an easy step to try the .officeUI files.
So I tried opening a .qat file in Notepad, and bingo! From there, it was an easy step to try the .officeUI files.
Best wishes,
Hans
Hans
-
- Panoramic Lounger
- Posts: 8163
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: see which macro is attached to a button
Yes, when you put it like that it is obvious really. I might have got there eventually but 'eventually' is a long time.HansV wrote:...easy...
Thanks again,
Ken