判断RTF域中的内容是否为空

判断RTF域是否有值(文本或附件):
On Error Goto label1  
Dim ws As New notesuiworkspace 
Dim uidoc As notesuidocument 
Set uidoc=ws.currentdocument 
Call uidoc.gotofield("richTextField") ‘将光标放在指定的域
Call uidoc.selectall  ’在编辑状态下选择指定域中的内容,在阅读状态下,选择文件的所有内容
Call uidoc.deselectall  ‘取消选择,如果没有选择任何,会报错“Document command is not available”
Exit Sub 
label1: 
Messagebox("RTF IS NULL!") 
Exit Sub
 
判断RTF域是否有附件:
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Dim rtitem As Variant
Call uidoc.Save
Set rtitem = doc.GetFirstItem("richTextField")
On Error Goto label1  
If rtitem.Type = RICHTEXT Then
Forall o In rtitem.EmbeddedObjects '如果没有附件,这句会报错
If o.Type = EMBED_ATTACHMENT Then
Messagebox("RTF field contains attachment")
Exit Sub
End If
End Forall
End If
label1: 
Messagebox("RTF field not contains attachment") 
Exit Sub
下载附件到本地磁盘:
Call o.ExtractFile("D:\" & o.Source)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值