错误提示英文是"Target frame is ancestor of script object"
错误提示英文是"Target frame is ancestor of script object"操作环境:
cs模式开发的库,采用帧结构集,在帧结构集的右边的帧结构中一个视图中的按钮中写lotusscript,
当运行时,经常会提示:错误提示英文是"Target frame is ancestor of script object"。
代码:
'全集团的实际分布,所有的PBC完成审批后才能统计
'20080709
'Msgbox "agent begin"
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim dlgdoc As NotesDocument
Dim tempdoc As NotesDocument
Dim uidoc As NotesUIDocument
Dim view As notesview
Dim tempview As NotesView
Dim vn_PBCPLFU As NotesView
Dim keystr As String
Dim selection As String
Dim dc As NotesDocumentCollection
Dim collstr As Variant
Dim deptcoll As Variant
Dim iColumn As Integer
Dim richStyle As NotesRichTextStyle
Dim richText As NotesRichTextItem
Dim styles(1 To 11) As NotesRichTextParagraphStyle
Dim ANum As Integer '绩效等级为A的PBC数量
Dim BBNum As Integer 'B+的PBC的数量
Dim BNum As Integer 'B的数量
Dim CNum As Integer 'C的数量
Dim DNum As Integer 'D的数量
Dim TotalNum As Integer '全集团PBC总的数量
Dim APercent As Variant
Dim BBPercent As Variant
Dim BPercent As Variant
Dim CPercent As Variant
Dim DPercent As Variant
'初始化
ANumSum = 0
BBNumSum = 0
BNumSum = 0
CNumSum = 0
DNumSum = 0
APercentSum = 0
BBPercentSum = 0
BPercentSum = 0
CPercentSum = 0
DPercentSum = 0
Set db = s.CurrentDatabase
Set view = db.GetView("(vn_AllPBCNotCompleted)") '未完成审批的PBC
Set dc = view.GetAllDocumentsByKey("%")
'Msgbox "未完成的PBC:"
'Msgbox dc.Count
If dc.count>0 Then
Msgbox "有PBC未完成绩效等级评估,暂不能查看全集团的实际绩效等级分布"
Exit Sub
End If
'如果全集团所有PBC都已经完成审批,则求出各个绩效等级的数量和百分比
Set vn_PBCPLFU = db.GetView("(vn_AllPBCCompleted)")
Set dc = vn_PBCPLFU.GetAllDocumentsByKey("%")
TotalNum = dc.Count
Set dlgdoc = New NotesDocument(db)
dlgdoc.Form = "fm_PBCCalssDistribution"
If dc.Count <> 0 Then
'初始化变量
ANum = 0
BBNum = 0
BNum = 0
CNum = 0
DNum = 0
'分别求出A、B+、B、C、D的PBC数量和PBC的总数
Set tempdoc = dc.GetFirstDocument
Do While Not tempdoc Is Nothing
If tempdoc.PBCClass(0) = "A" Then
ANum = ANum + 1
Elseif tempdoc.PBCClass(0) = "B+" Then
BBNum = BBNum + 1
Elseif tempdoc.PBCClass(0) = "B" Then
BNum = BNum + 1
Elseif tempdoc.PBCClass(0) = "C" Then
CNum = CNum + 1
Elseif tempdoc.PBCClass(0) = "D" Then
DNum = DNum + 1
End If
Set tempdoc = dc.GetNextDocument(tempdoc)
Loop
'求出各个等级所占的百分比
If TotalNum <> 0 Then
APercent = ANum/TotalNum
BBPercent = BBNum/TotalNum
BPercent = BNum/TotalNum
CPercent = CNum/TotalNum
DPercent = DNum/TotalNum
End If
'为dlgdoc赋值,实际分布汇总
dlgdoc.APercent = APercent
dlgdoc.BBPercent = BBPercent
dlgdoc.BPercent = BPercent
dlgdoc.CPercent = CPercent
dlgdoc.DPercent = DPercent
dlgdoc.ANum = ANum
dlgdoc.BBNum = BBNum
dlgdoc.BNum = BNum
dlgdoc.CNum = CNum
dlgdoc.DNum = DNum
'Call ws.EditDocument(False, dlgdoc,True,,False)
'Call ws.SetTargetFrame("view")
Call ws.EditDocument(False, dlgdoc,True,,False)
'Set uidoc = ws.EditDocument(False, dlgdoc,True,,False)
End If
补充:企业软件 , Lotus