How to make the view collapse after calling the ViewRebuild?

Does anyone know how to do the above?

Thanks in advance

Subject: How to make the view collapse after calling the ViewRebuild?

Can you not stick @Command([ViewCollapseAll]) into an agent and call it from your LS?

Subject: RE: How to make the view collapse after calling the ViewRebuild?

My code in the PostOpen event is

Dim session As New NotesSession

Dim db As NotesDatabase

Dim agent As NotesAgent

Dim workspace As New NotesUIWorkspace

Call workspace.ViewRebuild



Set db = session.CurrentDatabase



Set agent = db.GetAgent("(View Collapse)")

agent.Run

However, an error message will prompt. “@Functions not allowed in this context”

The code of the agent is @Command([ViewCollapseAll])

ANy Idea? tks