使用 VBA 在 Word 文档中插入项目符号(Chr(183) 或 Chr(149))会导致非常小的项目符号

Inserting bullet (Chr(183) or Chr(149)) in Word doc using VBA results in very small bullet

我正在使用如下所示的 Access VBA 代码来创建 Word 文档并插入一些格式化文本。

我需要做的一件事是用项目符号分隔一些元数据。我们目前在 Access 报表中执行此操作(我们在 Access 语句中明确使用符号 SQL 来为报表构建数据),但现在需要使用 VBA 构建不同类型的文档。

我的研究表明项目符号是字符代码 183 或 149,但是当我们在 VBA 代码中同时使用这两个代码时,它会插入小项目符号而不是我们可以通过插入项目符号直接通过插入>符号菜单。

下面是一些示例代码,以及该代码输出的屏幕截图(手动添加了最后一行以显示我们可以手动添加的项目符号的大小)。关于如何通过 VBA 代码获得大子弹有什么建议吗?

' declare vars and set up

    Dim objWord As Word.Application
    Dim doc As Word.Document
    Dim WordHeaderFooter As HeaderFooter
    
    Set objWord = CreateObject("Word.Application")

' create doc and insert sample text

    With objWord
        
        .Visible = True
    
        Set doc = .Documents.Add
        doc.SaveAs CurrentProject.Path & "\TestDoc.doc"
        
    End With
                  
    With objWord.Selection
          
        .Font.Name = "Calibri (Body)"
        .Font.Size = 12
        .TypeText "Here is an example test line with Chr 183.  Date: " & Format(Now(), "Long Date") & " " & Chr(183) & " Time: " & Format(Now(), "Medium Time")
        .TypeParagraph
        .TypeText "Here is an example test line with Chr 149.  Date: " & Format(Now(), "Long Date") & " " & Chr(149) & " Time: " & Format(Now(), "Medium Time")
        .TypeParagraph
      
    End With
    
    doc.Save
    doc.Activate

您需要拆分字符串,在中间插入符号,然后插入时间。

试试这个:

With objWord.Selection
      
    .Font.Name = "Calibri (Body)"
    .Font.Size = 12
    .TypeText "Here is an example test line with Chr 183.  Date: " & Format(Now(), "Long Date") & " "
    .InsertSymbol CharacterNumber:=8226, Unicode:=True
    .TypeText " Time: " & Format(Now(), "Medium Time")
    .TypeParagraph
  
End With

它产生这个: