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.
LVL 15
Jamie GarrochSenior Technical Consultant at BrightCarbonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


pls try

Dim oShpNode As Office.Shape

instead of Dim oShpNode As Shape ' Powerpoint.Shape


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jamie GarrochSenior Technical Consultant at BrightCarbonAuthor Commented:
So simple Rgonzo1971. Thank you. Yet why do Microsoft have two (potentially more) different object models for something as basic as a shape object?!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft PowerPoint

From novice to tech pro — start learning today.