Advertisement
Guest User

Untitled

a guest
Jun 18th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub MergingExtend()
  2. rem ----------------------------------------------------------------------
  3.   Dim oDoc As Object, oSheet As Object, oCell As Object
  4.   oDoc=ThisComponent
  5.   oSheet=oDoc.Sheets.getByName("Control")
  6.   oCell=oSheet.getCellByposition(4,5) 'E6
  7.   print oCell.getvalue()
  8.  
  9. rem define variables
  10. dim document   as object
  11. dim dispatcher as object
  12. 'dim count%
  13. 'count = MaxRowCount()
  14. rem ----------------------------------------------------------------------
  15. rem get access to the document
  16. document   = ThisComponent.CurrentController.Frame
  17. dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
  18.  
  19. rem ----------------------------------------------------------------------
  20. dim args1(0) as new com.sun.star.beans.PropertyValue
  21. args1(0).Name = "ToPoint"
  22. args1(0).Value = "$A$1:$W$oCell.getValue()"
  23.  
  24. dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
  25.  
  26. rem ----------------------------------------------------------------------
  27. dim args2(0) as new com.sun.star.beans.PropertyValue
  28. args2(0).Name = "EndCell"
  29. args2(0).Value = "$W$"& oCell.getValue() &""
  30.  
  31. dispatcher.executeDispatch(document, ".uno:AutoFill", "", 0, args2())
  32.  
  33. rem ----------------------------------------------------------------------
  34. dim args3(0) as new com.sun.star.beans.PropertyValue
  35. args3(0).Name = "ToPoint"
  36. args3(0).Value = "$A$1:$W$oCell.getValue()"
  37.  
  38. dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
  39.  
  40. end sub
  41.  
  42. Function MaxRowCount() As Integer
  43.   Dim oDoc As Object, oSheet As Object, oCell As Object
  44.   oDoc=ThisComponent
  45.   oSheet=oDoc.Sheets.getByName("Control")
  46.   oCell=oSheet.getCellByposition(4,5) 'E6
  47.   MaxRowCount() = oCell.getValue()
  48.   'print MaxRowCount
  49. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement