![]() |
#1
|
|||
|
|||
![]()
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. |
#2
|
||||
|
||||
![]()
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] |
#3
|
|||
|
|||
![]()
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? |
#4
|
||||
|
||||
![]()
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] |
#5
|
|||
|
|||
![]()
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. |
#6
|
|||
|
|||
![]()
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? |
#7
|
|||
|
|||
![]()
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. |
#8
|
||||
|
||||
![]()
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
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? |
#10
|
||||
|
||||
![]()
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] |
#11
|
|||
|
|||
![]()
thank you so much for being so kind and helpful to me. I really appreciate that.
|
#12
|
|||
|
|||
![]()
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! |
#13
|
||||
|
||||
![]()
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] |
#14
|
|||
|
|||
![]()
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. |
#15
|
|||
|
|||
![]()
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 |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wierd symbols inplace of "space", "indentation" etc | aka.bhagvanji | Word | 5 | 02-16-2012 11:50 AM |
![]() |
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 |