Dzwebs.Net

撰写电脑技术杂文十余年

word vba 插入艺术字

Admin | 2016-5-9 8:08:29 | 被阅次数 | 7162

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

  在WORD中使用VBA插入艺术字,其实很简单,只需要使用简单的一行代码就可以了。

  ActiveDocument.Shapes.AddTextEffect(msoTextEffect13, "艺术字内容", "迷你简竹节", 24#, msoTrue, msoTrue, 236.1, 224.45)

  代码解释:msoTextEffect13指的是艺术字样式库里面的顺序号,第一个样式就是1,第二就是2,第13个自然就是msoTextEffect13。

  24# 指的是字号的大小,艺术字的字号,当前是14号的大小。

  知识拓展:判断文档中有多少个艺术字

  由于文档中的艺术字,有的可能设置了环绕而有的没有设置,因此,在检测的时候,得使用两部分代码方能全面检测出个数来。

  Dim TEcount As Integer, myshape As Shape, myin As InlineShape
    For Each myshape In ActiveDocument.Shapes
  If myshape.Type = msoTextEffect Then
         TEcount = TEcount + 1
  End If
  Next
   
  Dim MyTextEF As TextEffectFormat
  For Each myin In ActiveDocument.InlineShapes
      On Error Resume Next
      Set MyTextEF = myin.TextEffect
   If Err.Number = 0 Then
    TEcount = TEcount + 1
   End If
  Next
  MsgBox "文档中有" & TEcount & "处艺术字。"


该杂文来自: Word杂文

上一篇:雨后初晴的背景

下一篇:word vba 指定位置插入图片

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计