求助:高手请进,指点一下以下代码???
我在文档中调用EXCEL模板,每次打开不管有无编辑,关闭时均提示保存,代码如下,请高手指点错误
Sub Postopen(Source As Notesuidocument)
Set doc=source
Set note=doc.document
doc.horzscrollbar=True
path = "d:\1111.xlt"
If doc.isnewdoc And Dir$(path,0)="" Then
Msgbox"找不到模板文件"
doc.close
Exit Sub
End If
If doc.IsNewDoc Then
doc.gotofield("body")
Call source.CreateObject("OLEObject","",path)
Else
Set rtitem = note.GetFirstItem("body")
Set embed = rtitem.EmbeddedObjects(0)
Set oleobject = doc.GetObject(embed.name)
End If
If Source.isnewdoc Then
Exit Sub
Else
Dim sess As New notessession
Dim doc1 As notesdocument
Set doc1=Source.document
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Set db = sess.CurrentDatabase
Dim name1 As String
name1=sess.commonusername
Dim setdoc As notesdocument
Set setview=db.getview("(fileflowconfig)")
Set setdoc=setview.getfirstdocument
Dim menber As NotesItem
Set menber = setdoc.GetFirstItem( "menber4" )
If menber.Contains( name1 ) Then
Source.EditMode=True
Continue=True
Goto dd
End If
Dim currentapprover As String
currentapprover=Source.fieldgettext("CurrentApprover")
Dim status As String
status=Source.fieldgettext("Status")
If (Instr(currentapprover,name1) And status<>"3") Then
Source.EditMode=True
Continue=True
Else
Source.EditMode=False
Continue=False
End If
End If
dd:
End Sub
我尝试过,如果不加以下字段无问题,加上后既出问题,而我有必须嵌入预先定义好的一个模板,请高手指点
Set doc=source
Set note=doc.document
doc.horzscrollbar=True
path = "d:\1111.xlt"
If doc.isnewdoc And Dir$(path,0)="" Then
Msgbox"找不到模板文件"
doc.close
Exit Sub
End If
If doc.IsNewDoc Then
doc.gotofield("body")
Call source.CreateObject("OLEObject","",path)
Else
Set rtitem = note.GetFirstItem("body")
Set embed = rtitem.EmbeddedObjects(0)
Set oleobject = doc.GetObject(embed.name)
End If
加了saveoptions域后,效果不是很好,我所有代码均放在postopen事件中,和次有关吗??
请高手指点一二