VSTO Addin - Own button type like "ShapeWidth" and "ShapeHeight" - vsto

I am currently working on an PowerPoint Addin and I am currently finishing the Ribbon. I'd like to create a control to change the size of objects that looks similar to the inbuild button "ShapeWidth" and "ShapeHeight":
However, I couldn't find the correct control type and hence I built the below by myself using an editbox and buttons. Although it's working I find the other style way cleaner but I haven't found the correct type.

Not all Ribbon X (Office Fluent UI) control types that Microsoft uses in its Office applications are made available to third-party developers. This, I'm afraid, falls into that category.
You should probably be able to get the image, at least, by specifying the idMso for the built-in control.

Related

Creating your own custom RibbonControl type in Word VSTO

I have created a Word VSTO add-in. I would like to create a custom RibbonControl type in my add-in Ribbon, to show information to the users. It would only be text.
I have tried using "Label" or "EditBox" to the purpose, but it looks awful. I have also tried creating a custom control and implement the RibbonControl interface but it doesn't work.
I have used the designer way to create the ribbon. Can the XML method be used and how?
I have googled for hours and I am not sure that is is possible at all. Any clues?
No, you cannot create your own custom ribbon controls, you are limited to the built-in controls.

Word Add-in - find if dialog has focus?

I am writing a word add-in in VB .NET (using Add-in Express, but I don't think that's relevant).
I have created shortcuts, but I only want them to take effect if the document itself is in focus, not a dialog - for example, "Find and replace" or any other.
How do I determine if a dialog has focus?
The "Selection" property of the application points to the selection in the document, even if a dialog is currently selected. I can't find any "HasFocus"-equivalent property anywhere either. I'm running out of ideas :o)
Thanks!
This workaround worked for me:
My add-in keeps a reference to the handle of the most recently activated Word window, by using the GetActiveWindow API during the WindowActivate event of the Word application. This is necessary since, up until Office 2013, the Window object does not expose a handle property.
When a shortcut is triggered, I compare that to the handle of the currently active window, using the same API. If they don't match, I simply don't proceed :o)

How to identify a specific ActiveX Interface based on limited information

I am in the process of developing an ActiveX control for embedding in Rockwell Automation's Factory Talk View. (See ActiveX DLL Error: Solved to see how great a start I got off to!)
At the moment I have an ActiveX control that seems to embed into the host system OK, but is not fully integrated into the VBA process. I believe that this is because I have not implemented some specific COM interface that is required, but I have no documentation as to what that is. I do know that standard MS controls like the Microsoft Forms 2.0 controls do implement the required interface and fully integrate.
The key functionality I am missing relates to a property that I need to set in order for my VBA code to actually see the ActiveX object. This property can be seen when opening the property panel for any activeX control placed on a Factory Talk screen, but NOT when looking at the properties of ActiveX controls embedded in (for example) Excel. Thus I am probably trying to chase down some custom Rockwell implementation. I am hoping that SO might be able to give me some aid into how to track down what I want based on recognizing the functionality it implements.
Now to the actual property. In Factory Talk the property is called "ExposeToVBA", and has a type "long". You have a choice of 3 values selected from a drop down list:
Not Exposed - When set to this, the controls name is not even visible to VBA code
Type Info Extension - Not sure what this does
VBA Control - VBA code can see and interact with the control.
When I select anything other than "Not Exposed" for my control, I get a warning dialog box with no text on it. For other controls I need to set it to "VBA Control" in order to interact with it in the VBA code (d'oh)
I suspect that the value of this property is translated into some calls to an ActiveX interface on the target control.
The Question
What I want to do is identify what interfaces something like a "Forms 2.0 Label" implements that would match the above functionality. And also perhaps how I could translate this into my C# based control (based on C# ActiveX control (CSActiveX))
I know its a long shot, but I'd appreciate any and all suggestions
This became moot when I found a canned Active-x control that had the functionality that I needed.
FWIW This is what I believe that I used: DMGraph

Customize Office Ribbon programmatically

I am writing an addin to Office (both 2007 and 2010), and have so far used the Fluent Ribbon XML to customize the different ribbons.
The problem I am having now with that approach, is that I want to have a bit more flexibility in my code, and have different modules add more buttons to the ribbon, without hard coding them in XML - The addin is composed of several disconnected modules, and it doesn't "know" exactly what ribbon elements it might need.
Is there a way to do it? I bumped into the LoadCustomUI method on the Application object, but it is not available in C#. Looks like just what I might have used for my scenario.
For .NET 4 (which I assume you're using because of targetting Office 2010), you'll override CreateRibbonExtensibilityObject. More info can be found on this page: Ribbon Object Model. This is also a good read: Updating the Controls on a Ribbon at Run Time.

Read values from the Office 2007 ribbon using VBA

Using VBA, can I find out the value of a text (combobox) control on the Word 2007 ribbon?
Say I'd want to read the currently selected font name in the "Home" tab.
I've seen an example using the IAccessible interface to do some interaction with the Ribbon (namely enumerating it), but it seems reading a control value is not possible. Is there another way to do it, or is VBA locked out completely?
I don't think you can get at the ribbon to read the built in properties.
For you specific example of Font name you can use the following.
Msgbox Application.Commandbars.Findcontrol(ID:=1728).Text
You maybe able to adpat the approach for other information.