求助:高手请进,指点一下以下代码???

lzhao0216 2002-09-18 10:01:23
我在文档中调用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事件中,和次有关吗??
请高手指点一二
...全文
31 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzhao0216 2002-09-24
  • 打赏
  • 举报
回复
请高手指点,谢谢
lzhao0216 2002-09-23
  • 打赏
  • 举报
回复
请指点,谢谢
lzhao0216 2002-09-21
  • 打赏
  • 举报
回复
是的,excel中有一个存入数据库的宏,请指点
gwmdj 2002-09-20
  • 打赏
  • 举报
回复
我想你在表单打开时(postopen事件)运行程序为文档附加拉一个附件而改变了
文档所以关闭时提示保存。如果EXCEL模板关闭时提示保存是否EXCEL模板有宏之类
的东西
lzhao0216 2002-09-19
  • 打赏
  • 举报
回复
请高手指点,分不够可以再加

535

社区成员

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

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