Jamie Garroch (MVP)
asked on
Differentiating and using Office.ColorFormat object versus PowerPoint.ColorFormat
I have a procedure running in the PowerPoint VBE that checks various properties of a chart shape. For example, let's take the ChartTitle object which is essentially a text box.
I am passing the ColorObject of the shape fill and font fill of the ChartTitle text box to a function to check its properties with these lines:
I then tried modifying the function to use the Office library:
So, how can I tell which library an object in VBA belongs to and how can I manage the above situation when different parts of the object model appear to be using different libraries?
I am passing the ColorObject of the shape fill and font fill of the ChartTitle text box to a function to check its properties with these lines:
CheckColor oCht.ChartTitle.Format.Fill.ForeColor
CheckColor oCht.ChartTitle.Format.TextFrame2.TextRange.Font.Fill.ForeColor
The function signature looks likes this:Function CheckColor(thisColor as ColorFormat)
The problem is that the second call to the function fails with a Type Mismatch error. Both objects used in calling the function return "ColorFormat" when I use TypeName to inspect them.I then tried modifying the function to use the Office library:
Function CheckColor(thisColor as Office.ColorFormat)
Now the second call to the function works but the first doesn't.So, how can I tell which library an object in VBA belongs to and how can I manage the above situation when different parts of the object model appear to be using different libraries?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Simply didn't thought too much about it but variant implies flexibility
ASKER