|
OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy |
Extract text from SmartArt
The SmartArt object model is read-only which means that it is possible to iterate through the shapes and their properties but one cannot assign any values or properties. The way to do it is to treat the SmartArt as a regular group.
Sub SmartArtText()
Dim oSh As Shape
Dim oSubShape As Shape
Dim x As Long
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
If .Type = msoSmartArt Then
For x = 1 To .GroupItems.Count
With .GroupItems(x)
Debug.Print .Type
'''
End With
Next
End If
End With
End Sub
While the above example is expected to work it fails to do so in cases where your goal is to extract all the text or hyperlinks on that SmartArt because some bugs have crept in the object model. The way to get around this issue is to extract the shapes within the SmartArt and then extract all the info from the regular shapes.
This subroutine accepts the smartart shape and the slide on which it resides. It will create a duplicate slide with shapes of the smartart. We will use that new slide to extract the slide text and then delete the slide.
|
Copyright 1999-2018 (c) Shyam Pillai. All rights reserved.