When you can't find a method to accomplish a task using the UNO API, the next choice is usually to use the dispatcher. The most common method of creating a macro that uses the dispatcher is to use the macro recorder; use Tools Macros Record Macro to create a new macro.
Although the macro recorder is an excellent feature introduced with OOo 1.1.0, it has limitations. For example, it doesn't track what happens when a dialog is opened. I discovered this when I attempted to use the macro recorder to create a macro to import text files. The "Text (encoded)" import filter opens a dialog and asks questions about the imported file. The values entered in the dialog are not captured by the macro recorder.
The first step in manually writing a macro that uses a dispatcher (as opposed to using the recorder) is to search the list of supported commands (see Table 2 through Table 7). The second step is to download and consult the "slots.sxc" document to determine the supported arguments. The final step is to write the macro.
As an example, I decided to use the command "SendOutLineToStarlmpress", which automatically creates an Impress presentation that includes the outline of the current document. No arguments are required. See Listing 6 .
Sub CreateOutlineInImpress Dim oDispHelper as object Dim oProvider As Object oProvider = ThisComponent.CurrentController.Frame oDispHelper = createUnoService("com.sun.star.frame.DispatchHelper") oDispHelper.executeDispatch(oProvider,".uno:SendOutlineToStarlmpress",_ "", , Array()) End Sub