Design Pro

Generation

time complexitySun, 12 Feb 2023

2OMath_Selection() Dim oRng As Range Dim oStory As Range Dim sText As String Dim oOMath As OMath Dim oOMathPara As OMathPara Set oStory = ActiveDocument.StoryRanges(wdMainTextStory) With oStory.Find .ClearFormatting .Text = "\$(.*?)\$" .Replacement.ClearFormatting .Format = False .MatchWildcards = True .Execute Do While .Found Set oRng = oStory.Duplicate oRng.Collapse wdCollapseEnd sText = .Text Set oOMath = oRng.OMaths.Add Set oOMathPara = oOMath.Functions.Add(oFunCluster) oOMathPara.Range.Text = sText ActiveDocument.OMaths(1).BuildUp .Execute Loop End With End Sub

O(n^2)

Questions about programming?Chat with your personal AI assistant