
PowerPoint: DrawLine
We came across the question how invoke the command to draw a simple line in PowerPoint.
Starting from PowerPoint 2007 where the Ribbon influences the Userinterface in Office, normally you would do it by calling a function “ExecuteMso” on the Application.CommandBars collection.
The following code starts drawing a Rectangle:
Globals.ThisAddIn.Application.CommandBars.ExecuteMso("ShapeRectangle");Normally you would think the IdMso command name for this action would be named “ShapeLine”.
But unfortunately not in Office. Somehow the command name for it is called: “ShapeStraightConnector”, so the correct command for it would be:
Globals.ThisAddIn.Application.CommandBars.ExecuteMso("ShapeStraightConnector");No idea why they gave them that name. Anyhow – the Resoucres to find the corresponding idMso Control Ids are these two downloads that every serious Office Developer should have already downloaded and installed on their PC:
- Office Ribbon Control ID’s: http://www.microsoft.com/download/en/details.aspx?id=6627
- Office 2010 Add-In Icon Gallery: http://www.microsoft.com/download/en/details.aspx?id=21103
If you have questions regarding Office Add-In development the first point to ask is in the MSDN VSTO Forum.
In case you need support, training, consulting or a prototype for VSTO and Office Add-Ins, feel free to ask X4U for a specialist.
Greets – Helmut