CreateUnoServiceWithArguments Function

Instantiates a UNO service with the ProcessServiceManager, including supplemental optional arguments.


     CreateUnoServiceWithArguments(ServiceName As String, Arguments() As Variant) As Object

UNO services that can be used with CreateUnoServiceWithArguments function are identifiable with method names that follow a createInstanceWith.. or createWith.. naming pattern.


ServiceName: The UNO service name to be created.

Arguments: One to many arguments that specify the instance of the service. Arguments are stored as a one dimensional array, according to their positions in the constructor method definition.

Return value:

An instance of the given UNO service name, otherwise Null value.


For a list of available services, visit the com::sun::star Module reference page.


The example below displays a Save As dialog with two extra controls: a listbox and a checkbox.

    Sub FileSaveAsDialog()
       td =
       dlg = CreateUnoServiceWithArguments( _
          "", _
    End Sub ' FileSaveAsDialog

UNO services have an extensive online documentation in the website. Visit the FilePicker Service reference page to learn more about the methods provided by the service used in the example above.


The following code uses the service to sign the current document:

Sub  SignCurrentDocDialog
   Dim pv(0) as new
   pv(0).Name  = "StorageFormat"
   pv(0).Value = "ZipFormat"
   mode =
   sf = CreateUnoService("")
   storage = sf.createInstanceWithArguments(Array(ThisComponent.URL, mode.WRITE, pv))
   dds = CreateUnoServiceWithArguments( _
      "", _
      Array("1.2", True)) 
   dds.signDocumentContent(storage, Null)
End Sub ' SignCurrentDocDialog

CreateWithVersion and createWithVersionAndValidSignature constructor methods in UNO service indicate two different ways of instantiating this service with CreateUnoServiceWithArguments function.

Please support us!