I have a lotus script procedure in script library where dialogbox and notesuiworkspace.composedocument are used to allow users to create a document of a different database. The program works fine in 5 but generates “Object variable not set” errors in 6.0.1. Someone posted workarounds for the notesuiworkspace.currentdocument bug. Does any one have a solution of composedocument?
In case benpoole is complainning…, the line of the code that generates the error is – Set newUIDoc = ws.ComposeDocument(…).
Whenever someone reports a script bug for something buried in 100 lines of
code, they should be required to isolate the supposed bug and test for it.
The following code works like a charm under the 6.0.1 client…
[]
Dim ws As New NOTESUIWORKSPACE
Dim newuiDoc As NotesUIDocument
Dim mailDbInfo As Variant
mailDbInfo = Evaluate("@MailDbName")
Set newUIDoc = ws.COMPOSEDOCUMENT(mailDbinfo(0), mailDbInfo(1), "Memo")
Print "Form: " + newUIDoc.document.Form(0) 'we do this to make sure we
get a proper UIDocument handle
[]
So whatever the problem is with your code, it would seem that the relevant
method here performs as expected.
Andre is right. I got the same message when I manually compose an OPPORTUN form. The weird thing is that when I ran the lotus script debugger I don’t see the error. And when I turn off the debugger, I see the “Object variable not set” error. Even the error pops up, the form still opens.
Oooh yeah. That’s a nasty “gotcha” in Notes development.
Ages ago, I was scratching my head with some code that used the NotesUIWorkspace.EditDocument method in an r5 application. It was raising all manner of bizarre errors (which, if memory serves, differed depending on whether I was in the debugger or not)… but the one to look out for is the annoyingly-vague “catch-all” error code 4000.
In these scenarios, this usually means that the UI is having trouble with a nested event in the form used by the document you’re trying to edit. So, it sounds like your issue is a variant on that?
That’s one possibility. Another thing I always look for when I get an error I can’t reproduce in the debugger, is a script library that was modified more recently than the code that’s calling it. The debugger sort of recompiles everything in memory so that it can match code with lines; so, the debugger is not necessarily running the same code that you’re running when the debugger is off.
Use Tools / Recompile all LotusScript, and be especially on the lookout for any design elements that fail to recompile.
Andre Guirard
IBM Lotus Software
Enterprise Integration Team
Hi,the problem is in the postopen event of the new doc. In this event, the current document is not the correct current document. Use the “Source”(document) which is in the parameter of the event instead of calling ws.currentdoc. This problem is still in version 6.5.