?
Solved

Is there any way to access "Smartart object model" in MS-Office 2007 (Word, PPT, Excel) using VBA macro/C#/C++ ?

Posted on 2009-04-09
6
Medium Priority
?
3,263 Views
Last Modified: 2013-12-17
Hello Expert,

I want to extract information/properties of Smartart Graphics at runtime while an MS-Office document is opened.
So I need to access smartart object model of MS-Office 2007(Word, PPT, Excel) using VBA Macro/C#/Cplusplus.

Is there any way to access this Object model?

Thanks,
Ajit.
0
Comment
Question by:ashugarg00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 21

Expert Comment

by:GlennaShaw
ID: 24132260
0
 

Accepted Solution

by:
ashugarg00 earned 0 total points
ID: 24948975
Actually there is no SmartArt model supported in MS Office 2007. But several properties we can extract like:

Selection in SmartArt
Each time when selection changes in document (Word, Power point, Excel), WindowSelectionChange -event is Fired by the Application. Selection of element can be get from COM and different for Each Application.
For Powerpoint,
1.      Total Number of Elements selected in Powerpoint = (ActiveWindow -> ActiveWindow ->Selection -> ShapeRange -> Count).
2.      Array of selected shape = (ActiveWindow -> ActiveWindow ->Selection -> ShapeRange -> items).
3.      If ActiveWindow -> ActiveWindow ->Selection -> ShapeRange -> item(i) == msoSmartArt, the element is SmartArt.
4.      To Uniquely identify the SmartArt (Shape), Id/Name attribute is used.
5.      Up to now we are able to get the selection of the parent element of SmartArt. To Get the selection about the child element.
a.      If ActiveWindow -> ActiveWindow ->Selection-> hasChildShapeRange == true, then some child is selected in the Smartart, else not.
b.      Array of the SmartArt child elements  = (ActiveWindow -> ActiveWindow ->Selection -> ChildShapeRange->items).
c.      Count of Array of SmartArt elements = (ActiveWindow -> ActiveWindow ->Selection -> ChildShapeRange->Count).
d.      Z-order is unique for each shape, We can use it to identify the child shape.
For Word,
Two types of Smartart element are available in Word: Inline & Floating.
Inline SmartArt (WdInlineShapeSmartArt):
1.      Array of Inline Shape = (Application -> ActiveDocument -> InlineShapes -> items). For count of inline shapes use Count Property.
2.      If item-> type == WdInlineShapeSmartArt, Smartart inline found.
To indentify uniquely this inline shape, use Range property (Value of Start & End property). Id property is not associated with these shapes.
3.      For Child Selection read the Powerpoint Module.
Floating Smartart (msoSmartArt):
1.      Array of Shapes = (Application -> ActiveDocument -> Shpaes -> items).
2.      If item->type == msoSmartArt, Floating SmartArt fount. Id property is used to uniquely identify the element.
3.      For Child, same as in the Power point.
For Excel,
I think there is one or more solution possible to get the selection in SmartArt. Below is shown one solution:
1.      Selection object = (Application -> Selection)
2.      Get the type of selected element, If Type == msoAutoShape, selected element is Shape && If Child == true, selected element is Child element. If it is having ParentGroup property, check the Type property. If Type == msoSmartArt, we are sure about the Smartart element selection.
3.      Child element in Smartart is uniquely identified by its Z-order.
4.      If Single element is selected then ParentGroup is outside the element
5.      Selection element count = (Application -> Selection -> Count).
6.      If Count >= 1, check ParentGroup of each element, it will give details of the Smartart element.
7.      Access the selection object from following Class type, else you will not be able to get the property details.
1.      Single child selection type = Shape.
2.      Multiple child selection type = ShapeRange.
3.      No Child Selection type = GroupObject.
0
 

Expert Comment

by:ljw2006
ID: 35874316
Is there an updated answer to this question?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question