OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy Bookmark and Share

Detect MathZones in PowerPoint 2010

In PowerPoint 2010 Math Zones were introduced. A math zone is a text range within which math typography rules apply. The MathZones object was meant to be a way to detect such but sadly it's broken. It will always return 1 for any textbox with text. In 2013 it works correctly. So I had to come up with a hack to detect math zones. It works in almost all cases where you enter a proper equation. It relies on the fact that with math typography the texteffect property will return incorrect text to match against the value returned by the text range.

Supported versions: PowerPoint 2010+


' --------------------------------------------------------------------------------

' Copyright ©1999-2022, Shyam Pillai, All Rights Reserved.

' --------------------------------------------------------------------------------

' You are free to use this code within your own applications, add-ins,

' documents etc but you are expressly forbidden from selling or 

' otherwise distributing this source code without prior consent.

' This includes both posting free demo projects made from this

' code as well as reproducing the code in text or html format.

' -------------------------------------------------------------------------------
Function IsMathZoneIn2010(shp As Shape) As Boolean



If shp.HasTextFrame Then

	If shp.TextFrame2.HasText Then

		IsMathZoneIn2010 = shp.TextFrame2.TextRange.Text <> shp.TextEffect.Text

	End If

End If



End Function

 


Copyright 1999-2022 (c) Shyam Pillai. All rights reserved.