Associa il codice ad un evento, un pulsante, una combinazione di tasti come piu ti aggrada

codice:
sub partita 

dim document   as object 
dim dispatcher as object 

document   = ThisComponent.CurrentController.Frame 
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")  

dim cell as double 
aSheet = ThisComponent.CurrentController.ActiveSheet 
cell = aSheet.getCellRangeByName("B7").Value   

dim args2(0) as new com.sun.star.beans.PropertyValue 
args2(0).Name = "Name" 
args2(0).Value = "Partita " & cell  
dispatcher.executeDispatch(document, ".uno:RenameTable", "", 0, args2())   
end sub