简体   繁体   English

运行 MS Word,宏字体

[英]Running MS Word, Macro font

(Patience my stroke) (耐心我的中风)

What are the codes to create a table in MS Word, macro?在 MS Word、宏中创建表格的代码是什么? I need to make a table font.我需要制作表格字体。 If...Then...Else (Aharoni, Century Gothic, Arial). If...Then...Else (Aharoni, Century Gothic, Arial)。

在此处输入图片说明

Help?帮助?

So sorry :( I might merge:很抱歉:(我可能会合并:

在此处输入图片说明

This should get you started这应该让你开始

Option Explicit

Sub TestInsertTable()

    InsertTableAtSelection "Awesome", "Love," & vbCrLf & "Mum", "I miss you"

End Sub

Sub InsertTableAtSelection(LeftText As String, MidText As String, RightText As String)
' Inserts a 1 row, 3 column table at the cursor or start of the selection

Dim InsertHere                          As Word.Range
Dim my_Table                            As Word.Table
    Set InsertHere = Selection.Range
    InsertHere.Collapse direction:=wdCollapseStart
    Set my_Table = InsertHere.Tables.Add(Range:=InsertHere, numrows:=1, numcolumns:=3)

    With my_Table.Range.Cells(1).Range
        .ParagraphFormat.Alignment = wdAlignParagraphCenter
        .Text = LeftText
        .Font.Name = "Aharoni"
    End With

    With my_Table.Range.Cells(2).Range
        .ParagraphFormat.Alignment = wdAlignParagraphCenter
        .Text = MidText
        .Font.Name = "Century Gothic"
    End With

    With my_Table.Range.Cells(3).Range
        .ParagraphFormat.Alignment = wdAlignParagraphCenter
        .Text = RightText
        .Font.Name = "Arial"
    End With

    my_Table.Borders.Enable = True

End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM