Sub Initialize()
On Error GoTo a
Dim session As New NotesSession
Dim FSO As Variant
Set FSO = CreateObject("Scripting.FileSystemObject")
'PathName是获取服务器date目录:E:\Lotus\Domino\Data
Dim PathName As String
PathName = session.GetEnvironmentString("Directory",True)
'判断在date目录下是否找到模板文件
If Not (FSO.FileExists(PathName + "\sztest.ntf")) Then
Print|没有找到模板文件!|
Exit Sub
Else
Print|找到模板文件!|
'定义NTF模板数据库
Dim ntf As New NotesDatabase("",PathName + "\sztest.ntf")
'定义新数据库
Dim newdb As NotesDatabase
'用NTF模板创建一个新的数据库至指定路径
'路径:E:\Lotus\Domino\Data\backup下新建一个Newtest.nsf
Set newdb = ntf.CreateFromTemplate("",PathName + "\backup/Newtest",False)
'设置新数据库的标题
newdb.Title = "Newsztest"
End if
Exit sub
a:
MsgBox "错误在代理agent_replace的第" & Erl & "行,描述:---" & error
End Sub
On Error GoTo a
Dim session As New NotesSession
Dim FSO As Variant
Set FSO = CreateObject("Scripting.FileSystemObject")
'PathName是获取服务器date目录:E:\Lotus\Domino\Data
Dim PathName As String
PathName = session.GetEnvironmentString("Directory",True)
'判断在date目录下是否找到模板文件
If Not (FSO.FileExists(PathName + "\sztest.ntf")) Then
Print|没有找到模板文件!|
Exit Sub
Else
Print|找到模板文件!|
'定义NTF模板数据库
Dim ntf As New NotesDatabase("",PathName + "\sztest.ntf")
'定义新数据库
Dim newdb As NotesDatabase
'用NTF模板创建一个新的数据库至指定路径
'路径:E:\Lotus\Domino\Data\backup下新建一个Newtest.nsf
Set newdb = ntf.CreateFromTemplate("",PathName + "\backup/Newtest",False)
'设置新数据库的标题
newdb.Title = "Newsztest"
End if
Exit sub
a:
MsgBox "错误在代理agent_replace的第" & Erl & "行,描述:---" & error
End Sub