Hi Andrew,

>   'oFormDoc = oFormDef.execute(sOpenMode, nCmd, eEmpty)  ' Variable NOT 
> defined
>   'oFormDoc = oFormDef.execute(sOpenMode, nCmd, oNull)  ' Object 
> Variable NOT set
>   'oFormDoc = oFormDef.execute(sOpenMode, nCmd, NULL)  ' Object Variable 
> NOT set
>   'oFormDef.releaseCommandIdentifier(nCmd)

In all three cases, the error message was not about the last parameter,
but about "sOpenMode". |execute| does not take a string, but a
com.sun.star.ucb.Command - sorry for the confusion, I blindly assumed it
were a string. This of course (unnecessarily) complicates the macro when
using |execute|.

To make things worse, our implementation currently also requires a
OpenCommandArgument2 to be present in the Command structure - either
directly in its |Argument| member, or, if |Argument| is an array of
property values, in one of the values in this array. This again is
unnecessary, but sadly complicates things even more.

The complete solution would look as follows:

 Dim identifier as Long
 identifier = oForm.createCommandIdentifier()

 Dim UcbCommand as new com.sun.star.ucb.Command
 UcbCommand.Name = "openDesign"
 Dim Arguments as new com.sun.star.ucb.OpenCommandArgument2
 Arguments.Mode = com.sun.star.ucb.OpenMode.DOCUMENT
 UcbCommand.Argument = Arguments

 Dim environment as Object

 Dim component as Object
 component = oForm.execute( UcbCommand, identifier, environment )

This, of course, makes me to completely withdraw my statement about
|execute| being easier to use than |loadComponentFromURL| :(
(though I think we will do something about it, at least we should not
required an OpenCommandArgument, but default it)

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer         [EMAIL PROTECTED] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Database                   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to