PermaLinkNotesUIWorkspace and document in preview pane
posted Tuesday 15th, June 2004
 



I received a call this morning from a user who was getting the infamous 'Object variable not set' error every time he'd open a certain view.


The culprit? It turned out that he had the preview pane open - only opened a few pixels, but it was open. This meant that Notes was grabbing whatever document happened to be selected, and was opening that document in the very small preview pane. And that meant that the Postopen event of the document's form was invoked. Well for many, many years, I have used a block of code like this in the Postopen event:

OK, I'm lazy I guess. My thought was to declare a few of the very common objects in the global declarations and then instantiate those objects in the Postopen event so that they were available to the rest of the form events. I had never heard of any problem like today's issue. Well after a very short time in the Lotusscript debugger, I could see that the NotesUIWorkspace object does not get set from the preview pane. What I mean is that this line:
Set ws = New NotesUIWorkspace
...does not appear to work if the document is being opened in the preview pane. So the solution was simply to set 'uidoc' equal to 'Source', rather than trying to reference the CurrentDocument property of the NotesUIWorkspace object.

Yes, it was a quick fix, and I do need to revisit the code, but I'd thought I'd share...Oh, and if you are someone stuck supporting code I've written, you may want to check my code droppings :-) ...and, of course if I'd followed my own advice there would have been a meaningful and helpful error message instead of the generic one. D'oh!
Comments :
 
 

1. Posted by Duffbert09/09/2007 08:42 PM



Being the aforementioned "someone" stuck maintaining your old code, I'll keep an eye out for that.