Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub MergingExtend()
- rem ----------------------------------------------------------------------
- Dim oDoc As Object, oSheet As Object, oCell As Object
- oDoc=ThisComponent
- oSheet=oDoc.Sheets.getByName("Control")
- oCell=oSheet.getCellByposition(4,5) 'E6
- print oCell.getvalue()
- rem define variables
- dim document as object
- dim dispatcher as object
- 'dim count%
- 'count = MaxRowCount()
- 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:$W$oCell.getValue()"
- dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
- rem ----------------------------------------------------------------------
- dim args2(0) as new com.sun.star.beans.PropertyValue
- args2(0).Name = "EndCell"
- args2(0).Value = "$W$"& oCell.getValue() &""
- dispatcher.executeDispatch(document, ".uno:AutoFill", "", 0, args2())
- rem ----------------------------------------------------------------------
- dim args3(0) as new com.sun.star.beans.PropertyValue
- args3(0).Name = "ToPoint"
- args3(0).Value = "$A$1:$W$oCell.getValue()"
- dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
- end sub
- Function MaxRowCount() As Integer
- Dim oDoc As Object, oSheet As Object, oCell As Object
- oDoc=ThisComponent
- oSheet=oDoc.Sheets.getByName("Control")
- oCell=oSheet.getCellByposition(4,5) 'E6
- MaxRowCount() = oCell.getValue()
- 'print MaxRowCount
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement