如何知道rtf域 附件的 文件个数?

kingman888 2003-08-29 03:42:00
Dim doc As notesdocument
Dim o As NotesEmbeddedObject
Dim attfile As String
Dim j As Integer
Dim jjj As Integer
Dim rtitem As Variant
jjj=0
For i = 1 To dc.Count
Print jjj
Set doc = dc.GetNthDocument(i)
Set rtitem = doc.GetFirstItem("body")
j=0
Forall oo In rtitem.EmbeddedObjects
If ( oo.Type = EMBED_ATTACHMENT ) Then
j = j + 1
End If
End Forall
Msgbox j

Next

我的代码有时运行正常,有时就正常 ,报错如下:
Type dismatch

其中body是rtf域
...全文
59 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿古 2003-09-03
  • 打赏
  • 举报
回复
我的那个是代理。 你可以稍加修改就可以使用在别的地方。
阿古 2003-09-03
  • 打赏
  • 举报
回复
看看我的方法:刚想出来的。

经过测试正确。

Sub Initialize

On Error Goto msg
Dim s As New NotesSession
Dim db As NotesDatabase
Dim bsdoc As NotesDocument
Dim item As notesitem
Dim j as integer

Set db=s.CurrentDatabase
Set bsdoc=s.DocumentContext

Set newdoc = New NotesDocument(db)

newdoc.subject="Copy《"+bsdoc.subject(0)+"》的文件"
newdoc.Form="test"

j=0

If bsdoc.HasItem("$File") Then

For i=0 To 50 '最多50个附件
Set item = bsdoc.Items(i)
If item.name="$FILE" Then

j=j+1

End If
Next

End If

msgbox(j) 'j就是这片文档的附件个数

msg:
Resume Next

End Sub
ntko 2003-09-01
  • 打赏
  • 举报
回复
应该这样:首先要Isarray(rtitem.EmbeddedObjects)判断是否存在嵌入对象。
If (rtitem.Type = RICHTEXT) And (Isarray(rtitem.EmbeddedObjects))Then
Forall o In rtitem.EmbeddedObjects
Print "type=" & o.type
Select Case o.Type
Case EMBED_ATTACHMENT:
'在此写你的计数代码
Print "Type=Attatchment,Source=" & o.Source & ",filesize=" o.FileSize
Case EMBED_OBJECT:
Print "Type=Object,name=" & o.Name & "Source=" & o.Source
Forall v In o.Verbs
Messagebox( v )
End Forall
Case EMBED_OBJECTLINK:
Print "Type=Objectlink,name=" & o.Name & "Source=" & o.Source
Case Else:
Print "Type=other,name=" & o.Name
End Select
End Forall
End If
ygtel 2003-09-01
  • 打赏
  • 举报
回复
intCount = Evaluate("@Elements(@Attachments)", doc)
sacrefies 2003-08-30
  • 打赏
  • 举报
回复
请最好不要这样使用

因为一些内嵌应用程序也是EMBEDDEDOBJECTS

NotesDocument 对象中有附件的专门方法。

请注意:附件是针对文档的,不是针对RICHTEXTITEM的,而“内嵌对象”正好相反,虽然附件也可以算成是内嵌对象。

有时不需要RICHTEXTITEM文档一样可以有附件的

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧