VBA for Word sets the font format

Source: Internet
Author: User

The following code sets the various formats for Word fonts through VBA code.

WApp.Selection.Font.NameFarEast = "XXFarEastFont-Arial";

WApp.Selection.Font.NameAscii = "Times New Roman";

WApp.Selection.Font.NameOther = "Times New Roman";

WApp.Selection.Font.Name = "Song Body";

WApp.Selection.Font.Size = float. Parse ("14");

WApp.Selection.Font.Bold = 0;

WApp.Selection.Font.Italic = 0;

WApp.Selection.Font.Underline = Microsoft.Office.Interop.Word.WdUnderline.wdUnderlineNone;

WApp.Selection.Font.UnderlineColor = Microsoft.Office.Interop.Word.WdColor.wdColorAutomatic;

WApp.Selection.Font.StrikeThrough =0;//Delete Line

WApp.Selection.Font.DoubleStrikeThrough = 0;//Double Delete line

WApp.Selection.Font.Outline =0;//Hollow

WApp.Selection.Font.Emboss = 0;//Embossed

WApp.Selection.Font.Shadow = 0;//Shadow

WApp.Selection.Font.Hidden = 0;//hidden text

WApp.Selection.Font.SmallCaps = 0;//Small Caps

WApp.Selection.Font.AllCaps = 0;//All capitals

WApp.Selection.Font.Color = Microsoft.Office.Interop.Word.WdColor.wdColorAutomatic;

WApp.Selection.Font.Engrave = 0;//Engraved

WApp.Selection.Font.Superscript = 0;//Superscript

WApp.Selection.Font.Subscript = 0;//Subscript

WApp.Selection.Font.Spacing = float. Parse ("0");//Character spacing

WApp.Selection.Font.Scaling = 100;//character Scaling

WApp.Selection.Font.Position = 0;//Position

WApp.Selection.Font.Kerning = float. Parse ("1");//font spacing adjustment

WApp.Selection.Font.Animation = microsoft.office.interop.word.wdanimation.wdanimationnone;//Text effect

WApp.Selection.Font.DisableCharacterSpaceGrid =false;

WApp.Selection.Font.EmphasisMark = Microsoft.Office.Interop.Word.WdEmphasisMark.wdEmphasisMarkNone;

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.