[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
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,283 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

656 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