Ask Your Question

Revision history [back]

I too struggled with this until I finally and got it to work. Here is the key point:

  • Sometimes the 'Record Macro' doesn't work for clicking on toolbar shortcuts and you have to record going through the menus.

Example: What follows is an example to get a thick bottom border

sub BottomLineHeavy

rem ---- This macro was recorded using:
rem -- "Format (Alt+'0'), Cells (Alt+'l'+'Enter'), User-defined (Alt+'u' then use cursor keys
rem -- to navigate and spacebar to select sides - also note that the left side may be
rem -- selected by default - pressing the spacebar three times cycles through your
rem -- choices), Tab to Style (cursor up and down to select) then tab to Width to set
rem -- line thickness."

rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------

dim args1(7) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BorderOuter.LeftBorder"
args1(0).Value = Array(0,0,0,0,0,0)
args1(1).Name = "BorderOuter.LeftDistance"
args1(1).Value = 0
args1(2).Name = "BorderOuter.RightBorder"
args1(2).Value = Array(0,0,0,0,0,0)
args1(3).Name = "BorderOuter.RightDistance"
args1(3).Value = 0
args1(4).Name = "BorderOuter.TopBorder"
args1(4).Value = Array(0,0,0,0,0,0)
args1(5).Name = "BorderOuter.TopDistance"
args1(5).Value = 0
args1(6).Name = "BorderOuter.BottomBorder"
args1(6).Value = Array(0,0,44,0,0,44)
args1(7).Name = "BorderOuter.BottomDistance"
args1(7).Value = 0

dispatcher.executeDispatch(document, ".uno:BorderOuter", "", 0, args1())

end sub