Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-23-2025, 01:39 PM
macropod's Avatar
macropod macropod is offline VBA to turn a selected string into an equation Windows 10 VBA to turn a selected string into an equation Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,382
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub ConvertEquation()
Application.ScreenUpdating = False
Dim Rng As Range, objEqn As OMath, Correction As OMathAutoCorrectEntry
Application.OMathAutoCorrect.UseOutsideOMath = True
Set Rng = Selection.Range: If Rng.End = Rng.Paragraphs.First.Range.End Then Rng.End = Rng.End - 1
For Each Correction In Application.OMathAutoCorrect.Entries
  If InStr(Rng.Text, Correction.Name) > 0 Then Rng.Text = Replace(Rng.Text, Correction.Name, Correction.Value)
Next
Rng.OMaths.Add(Rng).OMaths(1).BuildUp
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
math equation



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to turn a selected string into an equation Checking whether the selected lies with in an equation field Bikram Word VBA 4 03-19-2022 09:54 PM
VBA to turn a selected string into an equation Wildcard replace any string in context with a specified string wardw Word 7 05-07-2018 09:13 AM
VBA to turn a selected string into an equation How can I compare a string in a cell to another string? Amitti Word VBA 2 04-10-2017 07:35 PM
VBA to turn a selected string into an equation Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
VBA to turn a selected string into an equation Why copying a paragraph to an equation ends without equation format??? Jamal NUMAN Word 2 04-24-2011 06:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft