从PowerPoint VBA创建3列Word页脚

时间:2013-09-19 19:12:23

标签: vba ms-word powerpoint footer multiple-columns

我正在从PowerPoint创建Word文档,在表格中复制幻灯片等。 然后我这样做一个页脚:

Const wdSeekCurrentPageFooter = 10
Const wdFieldEmpty = -1
...
wrdApp.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
wrdApp.Selection.TypeText Text:="Column1" & " " & CStr(Date) & " " & "Page "
wrdApp.Selection.Fields.Add Range:=wrdApp.Selection.Range, _
Type:=wdFieldEmpty, Text:="PAGE  ", PreserveFormatting:=True
wrdApp.Selection.TypeText Text:=" of "
wrdApp.Selection.Fields.Add Range:=wrdApp.Selection.Range, _
Type:=wdFieldEmpty, Text:="NUMPAGES  ", PreserveFormatting:=True

所以我在页脚中获得3个信息,但是我可以使用Tabs使它们显得很好,我想要像

  • 手动添加页脚,内置,空白(三列)或

  • 页脚,插入3个文本,编辑,插入对齐标签

但我无法使用PowerPoint VBA中的任何一种解决方案。

  1. 在循环浏览模板时,我无法看到" Building Blocks.dotx"

  2. 此代码中断(未找到命名参数)

    wrdApp.Selection.Range.InsertAlignmentTab Alignment:=0,Relative:=0,Leader:=0
    
  3. 我需要在2007年和2013年的办公室工作的解决方案。任何想法如何实现这一目标?

1 个答案:

答案 0 :(得分:1)

InsertAlignmentTab只有2个参数,Alignment和RelativeTo(不是Relative)

对于VBA来说,"见"参数的名称,你需要做一个     参考(工具 - >参考...)到Word对象模型。但是由于     你可能正在瞄准多个版本的Office     试图避免这种情况,在这种情况下,使用位置参数     通过

wrdApp.Selection.Range.InsertAlignmentTab 0, 0

重。为Building Block循环,我猜你不能保证Building Blocks.dotx存在。