Accessing UI classes from toolbar icon

I have a toolbar Icon that executes an agent which requires the NotesUIWorkspace. Under R5 and the R6 Beta releases the agent worked without a problem. But now when I test under R6.0.1, I am getting an error accessing the UIDoc. The toolbar formula I use is:

@Command([FileOpenDatabase];“”:“mynsf.nsf”);

@PostedCommand([ToolsRunMacro]; “myagent”);

@PostedCommand([FileCloseWindow]);

@PostedCommand([FileCloseWindow])

The agent code looks like this:

Dim wks   As New NotesUIWorkspace 

Dim uiDoc As NotesUIDocument

Set uidoc  = wks.CurrentDocument

If uidoc Is Nothing Then 

		' Agent ends up here

End If 

Has there been a change in accessing the UI Classes from the toolbar?

If so, how can I go around the problem?

If Not, what am I doing wrong under R6?

Subject: Accessing UI classes from toolbar icon

I am having the exact same problem, but I’m running the agent on a form instead of a view button. This has worked fine in R5 and I’ve done some looking, but I can’t see anything in the documentation for a solution. Any ideas?