0

我想使用 Word 文档作为模板来填写 Notes 数据。我有用五个 activex 文本框创建的 Word 文件。有人有如何使用 Lotusscript 访问这些文本框的示例吗?

乔丹

4

1 回答 1

0

这并不容易找到,但在这里。

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument

'get Current NotesDoc
Set uidoc = workspace.CurrentDocument
Set doc =uidoc.Document

'get WordDocument
Dim wApp As Variant 
Dim worddoc As Variant
Dim oTB As Variant
Set wApp=CreateObject("Word.Application")
wApp.Visible= True
Set worddoc= wApp.Documents.Add()
wApp.Visible = True
Call worddoc.InlineShapes.AddOLEControl ("Forms.TextBox.1")

'if you don't have the name off the TextBox1 let the system show you this with
'Msgbox ActiveDocument.InlineShapes(1).OLEFormat.Object.Name ,0, "title"

worddoc.TextBox1.Value ="Hello" 'or doc.field1(0)

End Sub

您的示例的不同之处在于我创建了 worddoc 和文本框。在您的情况下,您必须首先获取文件

Set wApps = CreateObject("word.application")
set worddoc = wApps.Documents.Open "C:\path-to-file\file.doc"

然后设置所有文本框的值

worddoc.TextBox1.Value ="Hello" 'or doc.field1(0)
worddoc.TextBox2.Value ="Hello" 'or doc.field1(0)
worddoc.TextBox3.Value ="Hello" 'or doc.field1(0)
于 2013-09-12T10:23:53.503 回答