当前位置:网站首页>Using macro code to generate handwriting automatically in word or WPS

Using macro code to generate handwriting automatically in word or WPS

2022-06-25 01:12:00 A Xiaobai who likes Technology

It can generate handwriting in batches by computer

Using language :VBA

1. open word In the view find macro open

2. choice View macro

3 . Select Create macro

4. Paste the code

5. Source code

Sub  Font modification ()
'
'  Font modification   macro 
'
    Dim R_Character As Range


    Dim FontSize(3)
    '  Font size in 5 Between values , Can rewrite 
    FontSize(1) = "17"
    FontSize(2) = "17"
    FontSize(3) = "17.5"


    Dim FontName(3)
    ' Font names fluctuate among the three fonts , It can be rewritten , However, it is necessary to ensure that the system has the following fonts 
    FontName(1) = "BoLeYaYati"
    FontName(2) = " I don't just like you "
    FontName(3) = " Yu Hongliang's handwriting in block letters ( One )"

    Dim ParagraphSpace(5)
    ' Row spacing   Equally distributed among certain values , It can be rewritten 
    ParagraphSpace(1) = "12"
    ParagraphSpace(2) = "13"
    ParagraphSpace(3) = "10"
    ParagraphSpace(4) = "11"
    ParagraphSpace(5) = "12"

    ' If you don't understand the principle , It is not recommended to modify the following code 

    For Each R_Character In ActiveDocument.Characters

        VBA.Randomize

        R_Character.Font.name = FontName(Int(VBA.Rnd * 2) + 1)

        R_Character.Font.size = FontSize(Int(VBA.Rnd * 1) + 1)

        R_Character.Font.Position = Int(VBA.Rnd * 2) + 1

        R_Character.Font.Spacing = 0


    Next

    Application.ScreenUpdating = True



    For Each Cur_Paragraph In ActiveDocument.Paragraphs

        Cur_Paragraph.LineSpacing = ParagraphSpace(Int(VBA.Rnd * 5) + 1)


    Next
        Application.ScreenUpdating = True

End Sub

 

 6. The operation results are as follows :


  Possible problems :

1.word How to activate the macro function in

 

 

 2. Font download

You can change it to your favorite font

The following are the download addresses of the three fonts used in the source code :

Yu Hongliang's handwriting in hard script and regular script ( One ) Font download _ Template King font Template King font (fonts.mobanwang.com), Provide Yu Hongliang's handwritten font in hard block letters ( One ) Font and other Chinese font font library download , For the vast number of users to design and make web pages to provide free font download .icon-default.png?t=M1FBhttp://fonts.mobanwang.com/201512/13247.html You don't just like fonts ,DNBZSXH typeface | I don't just like you typeface -TTF typeface / Unclassified Fonts - Word customer network I don't just like you typeface ( Font family name :DNBZSXH, I don't just like you ; Font style name :Regular), common 7874 Characters . Character distribution range : Basic Latin , Latin -1 Add , Latin expansion -A, Latin expansion -B, International Phonetic extension , Blank modifier letters , Greek and Coptic , Cyrillic , General punctuation marks , Superscripts and subscripts , Currency symbols , Like alphabetic symbols , Digital form , The arrow symbol , Mathematical symbols , Miscellaneous technical symbols , Circled alphanumeric , tabs , Geometry , Miscellaneous symbols , CJK symbols and punctuation , Hiragana , Katakana , Bopomofo symbol , Circled CJK letters and months , CJK compatible characters , The unified ideograph of China, Japan and South Korea , Special area , CJK compatible form , Halfwidth and fullwidth characters https://www.fontke.com/download/?hash=0uCyazonwzcvSrfnQfD%2FtvRuse13MjPJVxe7SVoO89ADM65T5SgGX2iCNRrwfHQZZCx6JYHsHrmsM2ffHYruNYOXrItrlUiObgtgwAFgah12Cvf3BBCkN0YH9v5H777T&name=%E5%AF%B9%E4%BD%A0%E4%B8%8D%E6%AD%A2%E6%98%AF%E5%96%9C%E6%AC%A2.ttf&package=1BoLeYaYati typeface |BoLeYaYati Version 1.00 June 13, 2016, initial release typeface -TTF typeface / Unclassified Fonts - Word customer network BoLeYaYati Version 1.00 June 13, 2016, initial release typeface ( Font family name :BoLeYaYati; Font style name :Regular), common 7392 Characters . Character distribution range : Basic Latin , Latin -1 Add , Latin expansion -A, Latin expansion -B, Blank modifier letters , Greek and Coptic , Cyrillic , General punctuation marks , Currency symbols , Like alphabetic symbols , Digital form , The arrow symbol , Mathematical symbols , Miscellaneous technical symbols , Circled alphanumeric , tabs , Geometry , Miscellaneous symbols , CJK symbols and punctuation , Circled CJK letters and months , The unified ideograph of China, Japan and South Korea , Halfwidth and fullwidth characters https://www.fontke.com/font/26448591/3. Font installation

Decompress the font after downloading Put it at the following address :

C:\Windows\Fonts

 

原网站

版权声明
本文为[A Xiaobai who likes Technology]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202210543199671.html