Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-16-2011, 02:57 AM
b0x4it b0x4it is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Advanced Beginner
Convert all equations to "Normal Text"
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default Convert all equations to "Normal Text"

Is there any code to convert all equations in the document to "Normal Text"?



There is an option for making an equation "Normal Text", but I am looking for a code to do it for all equations.

I appreciate your reply.
Reply With Quote
  #2  
Old 05-16-2011, 04:12 AM
macropod's Avatar
macropod macropod is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Hi b0x4it,

You could do that with code like:
Code:
Sub Demo()
Dim MathObj As Object
For Each MathObj In ActiveDocument.OMaths
  MathObj.ConvertToNormalText
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-16-2011, 04:24 AM
b0x4it b0x4it is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Advanced Beginner
Convert all equations to "Normal Text"
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

Hi Paul,

Many thanks for all your replies to my threads. I really appreciate answering my questions. You are saving me lots of time.

How can I now specify a font to the MathObj?
Is there any way to see all the properties and functions of MathObj?
Reply With Quote
  #4  
Old 05-16-2011, 04:52 AM
macropod's Avatar
macropod macropod is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Hi b0x4it,

If you want to play with the font, you could use something like:
ActiveDocument.OMaths.Item(1).Range.Font.Name = "Courier New"

I don't know where the various properties, etc are documented. It's fairly easy to find out what there in the vbe, though, by typing 'omath' into the Object Browser. Or you can input 'ActiveDocument.OMaths' into a code module, then insert a period after it to get the pop-up for what available there. Likewise, you'll find another layer if you input 'ActiveDocument.OMaths.item(1)' into a code module, then insert a period after it, and so on.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-16-2011, 05:50 AM
b0x4it b0x4it is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Advanced Beginner
Convert all equations to "Normal Text"
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

Thank you Paul.
Now I want to change all numbers to Italic type. How can I search and change type of just a special character in equation to Italic or Bold?

I really appreciate you helping me.
Reply With Quote
  #6  
Old 05-16-2011, 05:58 AM
b0x4it b0x4it is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Advanced Beginner
Convert all equations to "Normal Text"
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

I found that I can scan all characters of the equation using
ActiveDocument.OMaths.Item(1).Range.Characters.Ite m(1)
and if it is numbers imply change its type. But is there any faster way to scan for all numbers and change their type?
Reply With Quote
  #7  
Old 05-16-2011, 06:25 AM
b0x4it b0x4it is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Advanced Beginner
Convert all equations to "Normal Text"
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

Paul, please how can I find just characters including a,b,c,...z and A,B,C,...,Z and small and all caps of greek characters? I mean how can I find out if a character is a,b,c,...z and A,B,C,...,Z or even greek?

many thanks for your reply.
Reply With Quote
  #8  
Old 05-16-2011, 02:21 PM
macropod's Avatar
macropod macropod is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Hi b0x4it,

I've been offline for a few hours - sleeping! We don't all live in your time zone.

You can manipulate the numbers in an equation as a group with code like:
Code:
Sub Demo()
Dim MathObj As Object
For Each MathObj In ActiveDocument.OMaths
  With MathObj
    .ConvertToNormalText
    With .Range.Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "[0-9]"
      .Replacement.Text = "^&"
      .Replacement.Font.Italic = True
      .Forward = True
      .Wrap = wdFindContinue
      .Format = True
      .MatchCase = False
      .MatchWholeWord = False
      .MatchAllWordForms = False
      .MatchSoundsLike = False
      .MatchWildcards = True
      .Execute Replace:=wdReplaceAll
    End With
  End With
Next
End Sub
Basically, this is just a wildcard Find/Replace on the oMath ranges
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 05-17-2011, 07:43 AM
b0x4it b0x4it is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Advanced Beginner
Convert all equations to "Normal Text"
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

thank you so much for the code and all your helps.
is there any way to search special greek characters like \theta, \phi, \betta in the text or an equation?
Reply With Quote
  #10  
Old 05-17-2011, 02:56 PM
macropod's Avatar
macropod macropod is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Hi b0x4it,

Finding any set of characters (or a particular character) is just a matter of changing the Find expression in the macro. So, for all Greek characters, change:
.Text = "[0-9]"
to:
.Text = "[" & ChrW(&H374) & "-" & ChrW(&H3FF) & "]"
The 'Greek' find spans all the characters you see in Insert|Symbol for the Greek & Cyrillic script. You can narrow the range if you want, but it won't make a significant difference to the macro's speed. There is also an extended Greek character set, with a different ChrW range, but I'd be surprised if they were being used in the equations.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 05-17-2011, 07:13 PM
b0x4it b0x4it is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Advanced Beginner
Convert all equations to "Normal Text"
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

thank you so much for being so kind and helpful to me. I really appreciate that.
Reply With Quote
  #12  
Old 12-03-2011, 01:35 PM
matin_vv matin_vv is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Novice
 
Join Date: Dec 2011
Posts: 3
matin_vv is on a distinguished road
Default

Hi.
I was looking for a way to automatically convert all my equations written using MS Word 2010 Equation maker to "Normal text" with italic Times new roman font (size: 12) and I found this precious topic.
Since I have no knowledge of writing macros, can anyone spare me the code I need?

Much appreciated!
Reply With Quote
  #13  
Old 12-03-2011, 02:57 PM
macropod's Avatar
macropod macropod is offline Convert all equations to "Normal Text" Windows 7 64bit Convert all equations to "Normal Text" Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Hi Matin,

Try:
Code:
Sub MathObjReFormat()
Dim MathObj As Object
For Each MathObj In ActiveDocument.OMaths
  With MathObj
    .ConvertToNormalText
    .Range.Font.Name = "Times New Roman"
  End With
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 12-03-2011, 09:26 PM
matin_vv matin_vv is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Novice
 
Join Date: Dec 2011
Posts: 3
matin_vv is on a distinguished road
Default

Thank you very much! It works like a charm....except the fact it doesn't change the font to "italic" and "Size 12"
Any solution?

My appreciation once again.

Last edited by matin_vv; 12-03-2011 at 10:26 PM.
Reply With Quote
  #15  
Old 12-04-2011, 06:55 AM
matin_vv matin_vv is offline Convert all equations to "Normal Text" Windows 7 32bit Convert all equations to "Normal Text" Office 2010 32bit
Novice
 
Join Date: Dec 2011
Posts: 3
matin_vv is on a distinguished road
Default

I think I managed the code. Here it is:

Sub MathObjReFormat()
Dim MathObj As Object
For Each MathObj In ActiveDocument.OMaths
With MathObj
.ConvertToNormalText
.Range.Font.Name = "Times New Roman"
.Range.Font.Size = 12
.Range.Font.Italic = True
End With
Next
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd symbols inplace of "space", "indentation" etc aka.bhagvanji Word 5 02-16-2012 11:50 AM
Convert all equations to "Normal Text" Partial highlighting of text in a row in "Final Showing Markup" setting Redpoint Word Tables 4 03-11-2011 04:29 PM
lines aren't visible in "normal" view emrlaw Word 2 05-12-2010 02:29 AM
"Microsoft Excel Application" missing in the "Component Services" on win08 sword.fish Excel 0 02-26-2010 02:09 PM
merge field formatting problem with "text to be inserted before" wissam Mail Merge 0 12-13-2009 12:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:05 AM.


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