Lotus notes 使用uidoc.copy时,文档命令不可用
当程序点击uidoc.Copy行时,我收到一个错误“Document command不可用”。我已经研究过这个错误消息。但我得到的只是,如果它与编辑模式有任何关系,我在这里根本不使用它Lotus notes 使用uidoc.copy时,文档命令不可用,lotus-notes,lotusscript,Lotus Notes,Lotusscript,当程序点击uidoc.Copy行时,我收到一个错误“Document command不可用”。我已经研究过这个错误消息。但我得到的只是,如果它与编辑模式有任何关系,我在这里根本不使用它 Sub Click(Source As Button) ' =========================================================== ' Get common username, mail server, and mailfile information
Sub Click(Source As Button)
' ===========================================================
' Get common username, mail server, and mailfile information
to be used on ComposeDocument method
Dim session As New NotesSession
Dim reg As New NotesRegistration
Dim user As String
reg.RegistrationServer = "Test"
user = session.CommonUserName
Call reg.GetUserInfo(user, _
mailserver$, _
mailfile$)
' ======================================================================
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Call uidoc.GotoField("QSContactEMail")
Call uidoc.SelectAll
Call uidoc.Copy
Set uidoc = workspace.ComposeDocument _
(mailserver$, mailfile$, "Memo")
Call uidoc.GotoField("Subject")
Call uidoc.Paste
End Sub
检查是否将名为$KeepPrivate的字段设置为“1”。它将防止复制 如果未选择任何内容,也可能发生错误。尝试在行前停止,并确保其高亮显示 此处还列出了其他条件:
您不需要使用复制和粘贴将值从一个文档传输到另一个文档。可以使用文档对象直接指定这些值 有几种方法可以做到这一点-这里有一种类似于您的方法。用以下内容替换第二行下方的所有内容:
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument, newuidoc as NotesUIDocument
Set uidoc = workspace.CurrentDocument
Set newuidoc = workspace.ComposeDocument _
(mailserver$, mailfile$, "Memo")
Call newuidoc.FieldSetText("Subject", uidoc.FieldGetText("QSContactEMail"))
End Sub
我在表单中没有看到$KeepPrivate字段。另外,当我调试代码并在复制之前停止时,字段没有高亮显示,但文档看起来像是向下滚动的。我试图复制的字段是计算字段是否重要?字段是计算字段是否重要。发生的情况是GotoField方法确实定位光标,但由于光标未定位在可编辑字段中,因此SelectAll方法的工作方式与文档处于读取模式时的工作方式相同。即,它不选择字段内容,而是选择整个文档内容。在这种情况下,复制方法实际上可以工作(至少对我来说是这样),但是粘贴可能会失败,除非您粘贴到富文本字段中。所以我不知道为什么复制对你来说失败了,但即使它真的成功了,它也可能不是你想要的。这回答了问题吗?