Here is a RECORDED macro code (using the keyboard, mouse and the Menu) for modifying the height of the first two non empty rows. (The non empty status is determined by my eyes)
The activity what was recorded:
- Jump to Cell A1 by mouse click,
- GoDown to the first non empty row by the Down arrow key
- Modify the format of the row by mouse in the Main menu
- Modify the format of the row by mouse in the Main menu
- GoDown by the Arrow key (the cursor is in the next non empty row)
Now you can organise the recorded code from the third activity to the last activity into a For...next cycle to modify the next non empty rows.
The recorded code:
Code: Select all
sub SetSpace2
rem ----------------------------------------------------------------------
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(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "By"
args2(0).Value = 1
args2(1).Name = "Sel"
args2(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "RowHeight"
args3(0).Value = 1016
dispatcher.executeDispatch(document, ".uno:RowHeight", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(1) as new com.sun.star.beans.PropertyValue
args4(0).Name = "By"
args4(0).Value = 1
args4(1).Name = "Sel"
args4(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "RowHeight"
args5(0).Value = 1016
dispatcher.executeDispatch(document, ".uno:RowHeight", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(1) as new com.sun.star.beans.PropertyValue
args6(0).Name = "By"
args6(0).Value = 1
args6(1).Name = "Sel"
args6(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args6())
rem ----------------------------------------------------------------------
dim args7(1) as new com.sun.star.beans.PropertyValue
args7(0).Name = "By"
args7(0).Value = 1
args7(1).Name = "Sel"
args7(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args7())
end sub