Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'get the content of the selected spreadsheet cells in open office / libre office
- Sub GetSelection()
- Dim oDoc, oSel, oCell
- oDoc = ThisComponent
- oSel = oDoc.getCurrentSelection()
- If oSel.supportsService("com.sun.star.sheet.SheetCell") Then
- MsgBox "One Cell selected and it contains: " & oSel.getString()
- Else
- If oSel.supportsService("com.sun.star.sheet.SheetCellRange") Then
- MsgBox "One Cell Range selected " & oSel.AbsoluteName 'Absolute Adresse der Selektion
- for i = 0 to oSel.getColumns.getCount - 1
- for j = 0 to oSel.getRows.getCount - 1
- oCell = oSel.getCellByPosition(i,j)
- msgbox "Cell " &i & ","& j & " string value " & oCell.String
- next
- Next
- Else
- If oSel.supportsService("com.sun.star.sheet.SheetCellRanges") Then
- Msgbox "Multiple Cell Ranges selected. Total=" & oSel.getCount()
- Else
- Print "Somethine else is selected."
- End If
- End If
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement