Not sure if it is a bug any more. Could be a Notes quirk.
The settings document wasn’t closed, but it was sent to a frameset of another application (that uses NotesUIWorkspace.SetTargetFrame). For all I know this is just Notes’ quirky way of doing things. If I call setTargetFrame(“someRandomValue”) before NotesUIWorkspace.EditDocument, the code works as designed.
–
In PostOpen: If you try to close the current NotesUIDocument, and open another using NotesUIWorkspace.EditDocument, both instances close. No error message.
The same code works in Notes 8.0.2.
If you use NotesUIWorkspace.URLOpen, it behaves as expected.
Code:
Sub Postopen(Source As Notesuidocument)
On Error Goto handleError
'UNID_SETTINGS -> @Password( "settings" ) without ( and )
'// If new doc, check for existing settings doc
If Source.IsNewDoc Then
Dim settingsDoc As NotesDocument
Set settingsDoc = s.currentDatabase.GetDocumentByUNID( UNID_SETTINGS )
'// Set static unid on new settings doc
If settingsDoc Is Nothing Then
Source.Document.UniversalID = UNID_SETTINGS
Else
'// Open existing settings doc
Dim ws As New NotesUIWorkspace()
Call ws.URLOpen( settingsdoc.NotesURL ) 'Works
'Call ws.EditDocument( False, settingsDoc ) 'Does not work
Source.Close True
End If
End If
Exit Sub
handleError:
If Err = 4091 Then Resume Next 'Invalid UNID
End Sub