VBA-disable a builtin button

  • Thread starter Thread starter Edward
  • Start date Start date
E

Edward

Hi every one,
It's easy to remove or disable a builtin button on the ribbon during the
customization of ribbon using XML , but is it possibile to disable or remove
a built in button ( like master view ) after openning the file ( wrting some
code in afterOpen () event to check if the attcahed template is a ceratin
template then disable master view function ) reason for this is because I
want to block users from altering the master when they work in ceratin
documnets ( they are all based on a custom designed .potx)
 
Thanks Chirag. I have an addin that is loaded for all the users all the time
( it creates a new tab on the ribbon ) , but users don't necessarily use the
addin functions ( like when they work on a PP that is not related to the
template ) , but as soon as they start working on the addin they need to use
a function which applies a specififc .potx file.
Now I have done all the customiziation of the ribbon in my addin file, I
think what you suggest as a document level customization is that I need to
write some XML code for that specififc .potx file and disable the master view
button , and everytime addin loads that template , or any file that is based
on that template won't have master view button , but it won't affect other PP
that are based on any other template ?
If my understandng is correct , this is exactly what I need to do .
 
Yes, for existing presentations in which you need to remove the Master view
buttons, you need to add the Ribbon customization in them in some way.

In any case, you need to change the presentation template and add your
Ribbon customization to it so that all new presentations created from it
would automatically have their Master view buttons removed.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
All right, I tested it , when I open the potx file ( by double clicking ) the
master button is not visible, but when I open a PP and then using design tab
apply this potx template it doesn't remove the master button ( this was my
expectation , the way I want the customization to work)Am I missing something
here?
 
Okay, this is the problem I have , I customzied the potx file ( removed
master button) and if I double click and open it it doesn't have the master
button, but unfortunatly this is not the way most people use our template ,
usually they open a regular PP and then apply that specififc potx file ( in
fact in my case there is an addin that when users insert a coverpage it
automatically applyies that potx file) in either case master view button is
still visiable although the attached template doesn't have master view button.
Yes, for existing presentations in which you need to remove the Master view
buttons, you need to add the Ribbon customization in them in some way.

So my question is how ? Is there a way to call a XML procedure in VBA which
removes master view button or XML code is only for the design time and we
can't use it in the run time? or is there a VBA only method ( like 03) that
we can simply disable a button?
 
Edward said:
So my question is how ? Is there a way to call a XML procedure in VBA
which
removes master view button or XML code is only for the design time and we
can't use it in the run time? or is there a VBA only method ( like 03)
that
we can simply disable a button?

For the add-in solution, one of the ways is to have your add-in handle and
respond to getVisible() callbacks to show/hide Master view buttons based the
conditions within your code. The XML would be similar to the document-level
XML.

The Ribbon model is on-demand. It knows when what needs to be updated and
calls the appropriate functions when required. There is also a way to let
the Ribbon know that a certain item on the Ribbon is outdated and Ribbon
would call the update functions when that item needs to be updated (for
instance, if its tab already in the view or other such conditions).

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
Back
Top