 |
 |
Thanks to Zeff Wheelock for the modified code -
1) Move the sysfile()'s before the While...Wend since you do not have to
redefine it each time you go around the loop
2) Get rid of the On error goto and the error routine and replace it with:
Dim testdb As New NotesDatabase("","")
If ( testdb.Open( tserver , sysfile( syscount ) ) ) Then
Call ws.AddDatabase( tserver , sysfile( syscount ) )
Else
Call item.AppendToTextList( "Could not add " &
sysfile(syscount) & " on server " & tserver & ": " & Error$() & Chr(13) )
Call doc.Save( False, True )
End If
3) change doc.save(false,true) to uidoc.save
Here is the modified code:
Sub Click(Source As Button)
Dim s As New notessession
Dim ws As New notesuiworkspace
Dim db As New notesdatabase("","")
Dim doc As notesdocument
Dim tdoc As notesdocument
Dim nab As Variant
Dim sview As notesview
Dim coll As notesdocumentcollection
Dim uidoc As notesuidocument
Dim servername As String
Dim nabname As String
Dim tserver As String
Dim item As notesitem
Dim sysfile(4) As String
Dim syscount As Integer
Set uidoc = ws.currentdocument
Set doc = uidoc.document
servername = doc.ServerName(0)
nabname = doc.NABName(0)
Call db.open(servername,nabname)
Set sview = db.getview("Server\Servers")
Set tdoc = sview.getfirstdocument
Set item = doc.GetFirstItem( "Audit" )
sysfile(0) = "mail.box"
sysfile(1) = "log.nsf"
sysfile(2) = "smtp.box"
sysfile(3) = "smtpibwq.nsf"
sysfile(4) = "smtpobwq.nsf"
While Not ( tdoc Is Nothing )
tserver = tdoc.ServerName(0)
syscount = 0
Forall x In sysfile
Dim testdb As New NotesDatabase("","")
If ( testdb.Open( tserver , sysfile( syscount ) ) ) Then
Call ws.AddDatabase( tserver , sysfile( syscount ) )
Else
Call item.AppendToTextList( "Could not add " &
sysfile(syscount) & " on server " & tserver & ": " & Error$() & Chr(13) )
End If
syscount = syscount + 1
End Forall
Set tdoc = sview.getnextdocument( tdoc )
Wend
Call uidoc.Save
End Sub |
Go back |
|  |
|