Vbscript 使用VBS在MSWord表格上方添加文本

Vbscript 使用VBS在MSWord表格上方添加文本,vbscript,ms-word,word-2010,Vbscript,Ms Word,Word 2010,我正在使用VBS在outlook中创建签名,以推送给我们的用户。签名中有表格,因此我可以将徽标/用户信息与徽标顶部的标准文本并排显示。(在此处找到原始表代码:) 下面是写入doc文件的代码片段。代码成功地创建了两个colun并将我想要的任何信息放入其中。在开始创建/编辑表格之前,是否有方法将文本添加到文档文件的顶部 Set objWord = CreateObject("Word.Application") objWord.Visible = True Set objDoc = objWord.

我正在使用VBS在outlook中创建签名,以推送给我们的用户。签名中有表格,因此我可以将徽标/用户信息与徽标顶部的标准文本并排显示。(在此处找到原始表代码:)

下面是写入doc文件的代码片段。代码成功地创建了两个colun并将我想要的任何信息放入其中。在开始创建/编辑表格之前,是否有方法将文本添加到文档文件的顶部

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.Style = "No Spacing"
Set objRange = objDoc.Range()
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries


'I want to add text here above the two tables below.  Not sure how to do it.


'Create Tables
objDoc.Tables.Add objRange, 1, 2
Set objTable = objDoc.Tables(1)

'** Logo table **
objTable.Cell(1, 1).select
'Put Logo information here

'** User table **
objTable.Cell(1, 2).select
'Put User information here

objSelection.EndKey 6  'Command to end the above tables

我通过使用这里的脚本偶然发现了这个问题:

'Create Tables
Set objRange = objSelection.Range 'Adding this line fixed the problem
objDoc.Tables.Add objRange, 1, 2
Set objTable = objDoc.Tables(1)