lotus ntes常用代码.docVIP

  • 2
  • 0
  • 约11.3万字
  • 约 13页
  • 2016-12-03 发布于河南
  • 举报
lotus ntes常用代码

lotus notes常用代码 lotusnotes常用代码 1.检测当前用户是不是文档的创建者,如果不是,不允许编辑文档。 Sub Querymodechange(Source As Notesuidocument, Continue As Variant) Dim session As New NotesSession Dim doc As notesdocument Dim userName As New NotesName(session.UserName) Set doc=source.document If Not ( source.EditMode ) Then If ( doc.authors(0) = username.CANONICAL ) Then continue=True Else Msgbox \您不是此文档的创建人,不可以修改!\,0,\文档数据库\ continue=False End If End If End Sub 2.退出时检测关键的域不能为空 Sub Click(Source As Button) Dim w As New notesuiworkspace Dim uidoc As notesuidocument Dim doc As notesdocument Set uidoc=w.currentdocument name1=uidoc.fieldgettext(\name\) If name1=\\ Then Messagebox \姓名不能为空!\,0,\通讯录\ Exit Sub End If Call uidoc.save Call uidoc.close End Sub 3.用私有视图来显示需要当前用户处理的文档,用以下视图公式: 注意建立视图时不要选中\保存到本地\选项,否则调试不便. SELECT Form = \收文1\ NextApprover=@Name([CN];@V3UserName) 4.Notes中Active控件 当文档中添加OLE或其他通用的ActiveX控件后,在文档的script编辑框右侧中,会自动添 加各种属性和方法在notes的类列表中.在script中声明该对象的 方法如下: Sub Postopen(Source As Notesuidocument) Dim w as notesuiworkspace Dim uidoc as notesuidocument Dim aa As Variant Set w =New notesuiworkspace Set uidoc =w.currentdocument Set aa=uidoc. getObject(\Chart\)\该句为ole对象声明,注意Chart是你给对象起的名 字 \接下来你就可以通过aa.**来调用其方法和属性了. End Sub 5.以下是script错误陷阱代码 Sub subname On Error Goto Errcode \下面添加你的程序代码 Exit Sub Errcode: Msgbox \错误 (\ Cstr(Err) \ ) - \ Error$(Err),16,\错 误提示\ Exit Sub End Sub 6.是否保存 在表单中设定一个域,名称为saveoption 下列公式添加到返回按钮中,决定文件退出是否保存 FIELD saveoptions:=\1\; 保存 FIELD saveoptions:=\0\; 不保存 7.用公式弹出对话框,按确定继续,取消返回. @If(@DialogBox(\表单名\;[AutoHorzFit]:[AutoVertFit];\表单标题\);\\;@Return(\ \)) 8.用script弹出对话框,按确定继续,取消返回 Dim w as notesuiworkspace If Not w.dialogbox(\表单名\,True,True,False,True,False,False,\填写\) Then doc.close\用户按取消退出 Exit Sub End If 9.视图中删除文档语句 @Command([EditClear]); @Command([ViewRefreshFields]) 10.检测是否是周末 Dim dt as notesdatetime call dt.setnow If Weekday(dt.lslocaltime)=7 Then\是周六耶, dt.adjustday(2) \加两天到星期一 Elseif Weekday(

文档评论(0)

1亿VIP精品文档

相关文档