Considerations when you use VBA to automatically generate formulas in Word

Source: Internet
Author: User

SUB&NBSP;GENEQ ()     if selection.start <> selection.end then         Dim objRange As Range         Dim objEq As OMath             Set objRange = Selection.Range          ' cannot add the following line of commented out code, otherwise the following flexible font controls will not be implemented in the Japanese version word 2007 and 2010           ' objrange.text = selection.range.text        set  Objrange = objrange.omaths.add (objrange)          ' flexible control of what type of word multibyte italic         For i = 1 To  objrange.characters.count            if  Objrange.characters (i). text like  "[A-za-z]" &NBsp then                 Objrange.characters (i). italic = true            else                 objrange.characters ( i). Italic = false            end if         next i        set  objeq = objrange.omaths (1)         objEq.BuildUp          ' Add the following line of code, will make the Japanese version of word 2007 and 2010 normal behavior, or there will be the following strange phenomenon, Chinese version word  2013 there is no such phenomenon:         ' in Word, enter x=3 in the first line, select x=3, use this function to generate a formula (X is italic, =3 is not italic), carriage return line , the current cursor will remain centered (for the same operation, the Chinese version word 2013 the cursor will stop at the left-aligned position),         ' re-enter y=x+ 1, select Y=x+1, use this function to generate formulas (Y=x+1 are not italic)         objEq.ParentOMath.Type =  Wdomathinline    end ifend sub

This article is from the "GONE with the Wind" blog, please be sure to keep this source http://h2appy.blog.51cto.com/609721/1604040

Considerations when you use VBA to automatically generate formulas in Word

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.