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
3,243 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

696 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