Link to home
Start Free TrialLog in
Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland

asked on

VBA Type Mismatch with Microsoft Office PowerPoint SmartArt node shape

I have a simple routine that loops through the nodes of a SmartArt object that starts like this:

Function LoopSmartArt(oShp as Shape)
  Dim oShpNode As Shape
  Dim oNode As SmartArtNode
  
  With oShp
    For Each oNode In .SmartArt.AllNodes
      For Each oShpNode In oNode.Shapes

Open in new window


The last line generates a Type Mismatch error but when I change the first Dim statement to be non-explicit:

   Dim oShpNode

Open in new window


And then examine the data type by inserting a breakpoint and using this in the immediate window:

?TypeName (oShpNode)

Open in new window


It returns "Shape".

Why is this a mismatch?!!!

Everything works as expected (except IntelliSense) when the variable is not defined as shape but this is really bugging me.
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jamie Garroch (MVP)

ASKER

So simple Rgonzo1971. Thank you. Yet why do Microsoft have two (potentially more) different object models for something as basic as a shape object?!