Enable built-in Office ribbon buttons which are disabled by Excel/PPT - excel

It is well documented how built-in ribbon buttons in Microsoft Office can be repurposed (here for instance), e.g. the Copy button. However, I am not aware of any method to take full control of the enabled state of repurposed built-in controls. For me this poses a problem since I would like to implement some extended functionality in Excel and PowerPoint for which in some cases the alignment buttons make sense. But they are disabled by Excel/PowerPoint so repurposing them does not work.
Disabling built-in button that would be enabled by default is not a problem. Defining a getEnabled callback for the built-in button seems to do the trick - problem solved.
But how to enable built-in ribbon button that would be disabled by default? (getEnabled does not help here)
I suspect there is no "VBA/VSTO way" to accomplish the task? Do you think it would be possible using COM, e.g. via IAccessible? So far I have only found ways to enumerate, select and invoke the button commands but not to change their state.

As the question got a few views I only wanted to confirm that there is no supported way to achieve what I wanted to the best of my knowledge. Neither the ribbon interface nor IAccessible help here. This is unfortunately the best answer I can give.

Related

How to detect what Ribbon is currently active in a Microsoft Office application?

I have looked at ActiveControlList but unfortunately it wasn't a reliable way to tell the active ribbon.
Specifically, I am looking for a reliable way to tell if Equation Tools ribbon is active in OneNote.
Do you have any suggestions ?
The ribbon is not a normal control and can be hard to work with from plain VBA or ahks built-in COM but you can use Microsoft's Active Accessibility API
You Can use the Acc lib so you don't need to know all the dll calls
But you still need to know what parts you need, and also what to look for to really use it. You can use jethrows AccViewer it will tell you the elements Role, State, ChildCount and more, so when you have found the item you're after, you can use the Tree or path that the accViewer gives.
Word ribbon path Example: 4.3.4.1.4.1.4.1.4.1.4.13.1.1
OneNote: 4.3.4.1.4.1.4.1.4.1.4.10.1.1
Here is an example using Acc_get() to show the current ribbon Name in OneNote PP 2010 when you press F6
f6::
name := Acc_Get("Name", "4.3.4.1.4.1.4.1.4.1.4.10.1.1", 0, "Ahk_class Framework::CFrame")
tooltip % name
return
Note: that this path is for when the ribbon is pinned i.e always visible
Forum topic with images
As far as I know there are no specific commands for Ribbon GUIs.
Use ImageSearch to detect changes in Ribbon GUI. You can search with ImageSearch image of activated Equation Tools control and if it finds it, it will set ErrorLevel to 1.
Also, always use AutoHotkey and its documenatation from http://ahkscript.org/ (current uptodate version, new official website)! AutoHotkey and its documentation from autohotkey.com is outdated and you may have some problems using them!

What is the difference between "Form Controls" and "ActiveX Control" in Excel 2010?

Using Microsoft Excel 2010, I noticed two kind of controls that can be inserted into a document: Form Controls and ActiveX Controls.
What is the difference between them?
Google is full of information on this. As Hans Passant said, Form controls are built in to Excel whereas ActiveX controls are loaded separately.
Generally you'll use Forms controls, they're simpler. ActiveX controls allow for more flexible design and should be used when the job just can't be done with a basic Forms control.
Many user's computers by default won't trust ActiveX, and it will be disabled; this sometimes needs to be manually added to the trust center. ActiveX is a microsoft-based technology and, as far as I'm aware, is not supported on the Mac. This is something you'll have to also consider, should you (or anyone you provide a workbook to) decide to use it on a Mac.
One major difference that is important to know is that ActiveX controls show up as objects that you can use in your code- try inserting an ActiveX control into a worksheet, bring up the VBA editor (ALT + F11) and you will be able to access the control programatically. You can't do this with form controls (macros must instead be explicitly assigned to each control), but form controls are a little easier to use. If you are just doing something simple, it doesn't matter which you use but for more advanced scripts ActiveX has better possibilities.
ActiveX is also more customizable.
It's also worth noting that ActiveX controls only work in Windows, whereas Form Controls will work on both Windows and MacOS versions of Excel.
Be careful, in some cases clicking on a Form Control or Active X Control will give two different results for the same macro - which should not be the case. I find Active X more reliable.

Recommendation for a multi-instance jquery dialog/overlay

Ok. had enough of trying out lightboxes, overlays and dialog boxes plugins. The problem is that very few of them support nested (multiple) dialog open at the same time - a typical requirement in my opinion.
I'm looking for a recommendation for a simple plugin that:
supports callsbacks for the usual onShow/onLoad... events
supports nested instances i.e. the user open a dialog, clicks a button on it, another dialog opens up while keeping the first one open in the background. In other words, it should support the closure of each instance programatically
is NOT the jquery ui dialog plugin
This came about after the big disappointment with SimpleModal's inability to support multiple modal boxes open simultaneously!!!! #EricM, why would you do that to me? why???? ;)
I have narrowed it down to jqModal and the jquery tools overlay. The usage of the latter is weird. Maybe i'm tired but i just don't get it.
So before i dive into jqModal, does anyone have any recommendation based on personal experience that will achieve what I'm trying to do?
thanks

Office 2007 Ribbon Programming How-to

I'm interested on how to get the old menus back for Office 2007. I know you can buy add-ins that do this, but I'm more interested on how these are done? I want to implement this at home and just need to be pointed in the correct direction!
Thanks!
These programs don't actually restore the old menu system, they modify the current Ribbon and then write the code to mock the old design.
This is where you need to start in order to modify the Ribbon.
http://msdn.microsoft.com/en-us/library/aa942866%28VS.80%29.aspx
I doubt the Ribbon is going to go away, so you probably will be better off taking the time to get used to it. I have, and now I much prefer this style menu system. In fact, I have been looking at code to implement this style in applications that I build.

Browser Context Menu customization?

Is there a way to override the "undo" and "select all" in right click context menu of the browser over textarea?
Thank you.
You cannot edit the browser's built-in context menu, but you can disable it and replace it with your own using the oncontextmenu event on the window object. I would caution that this is often a bad idea. Users expect to find the built-in context menu and are often frustrated when it isn't there.
I know you can prevent the whole context menu from opening by registering to the click() event, doing some cross-browser mumbo-jumbo to get wich button was clicked, and then return false if the right one was clicked.
However, I don't think it's possible to modify the context menu itself, at least not using javascript.
I should add that you may want to rethink why you're doing this. This will never be a protection against anything (some try to prevent copying images from their website), as it may simply be disabled by turning javascript off.
UPDATE: Ok, so you don't want to prevent users to do things, bug have them doing things your way. Then, I guess the best thing to do is :
Provide users with a toolbar that allow them to do these things (and thus making them use your actions instead of the default one
Map the usual keyboard shortcuts to your actions (Ctrl+A, Ctrl+Z, etc...)
Replace the right click menu with your own.
You mentionned in another comment that you cannot reproduce copy/paste, which is correct, but you can implement you own clipboard (that will only work for your webapp) if you really have to.

Resources