将单词宏转换为vbscript

时间:2015-11-23 07:01:18

标签: vbscript ms-word

我正在尝试使用不同的第一页创建docx文件,并在页脚中插入图像

Dim oWord 
Dim oDoc

Set oWord = CreateObject("Word.Application")
Set oDoc = CreateObject("Word.Document")

oWord.Visible = False
Set oDoc = oWord.Documents.Add

With oWord.ActiveDocument.PageSetup
    .DifferentFirstPageHeaderFooter = True
End With

With oWord.ActiveDocument
    .ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    .Application.Templates( _
    "C:\Users\User\AppData\Roaming\Microsoft\Document Building Blocks\1033\15\Built-In Building Blocks.dotx" _
        ).BuildingBlockEntries(" Blank").Insert Where=Selection.Range,     RichText _
    =True
.Selection.Fields.Add Selection.Range, wdFieldEmpty,  _
    "INCLUDEPICTURE  ""http://url.me"" \d ", PreserveFormatting=True
oWord.ActiveDocument.SaveAs("test.docx");

此错误

行:16 查尔:5 错误:集合中请求的成员不存在。 代码:800A1735 来源:Microsoft Word

为什么会发生这种情况的任何线索?

0 个答案:

没有答案