Ich habe in einem Writer Dokument eine Calc Tabelle integriert. Um in dieser Tabelle Änderungen vorzunehmen gehe ich mit einem Doppelclick hinein.
In der Calc Tabelle verschiebe ich aber normalerweise mit einem Doppelclick mehrere Zellen.
Hier ist der Code:
Sub M_move_cells_to_row_3
Dim oDoc
Dim oCelle
Dim oSheet
Dim oRow
Dim oColumn
Dim oRangeAddress
oDoc = thisComponent
' aktive Zelle
oCelle = oDoc.getCurrentSelection().getCellAddress()
' aktives Tabellenblatt
oSheet = oDoc.sheets(oCelle.Sheet)
' aktuelle Zeile, Index
oRow = oCelle.Row
' aktuelle Spalte, Index
' Gültige Zeile für move überprüfen
if oRow mod 7 - 2 <> 0 then
exit sub
end if
' aktuelle Spalte, Index
oColumn = oCelle.column
'msgbox "Spalte "+oColumn
if oColumn = 0 then
spalte = "A3:A9"
zeilen = "A"+(oRow+8)+":A"+(oRow+14)
end if
if oColumn = 1 then
spalte = "B3:B9"
zeilen = "B"+(oRow+8)+":B"+(oRow+14)
end if
if oColumn = 2 then
spalte = "C3:C9"
zeilen = "C"+(oRow+8)+":C"+(oRow+14)
end if
if oColumn = 3 then
spalte = "D3:D9"
zeilen = "D"+(oRow+8)+":D"+(oRow+14)
end if
if oColumn = 4 then
spalte = "E3:E9"
zeilen = "E"+(oRow+8)+":E"+(oRow+14)
end if
if oColumn = 5 then
spalte = "F3:F9"
zeilen = "F"+(oRow+8)+":F"+(oRow+14)
end if
'Platz machen
oRangeAddress = oSheet.getCellRangeByName(spalte).getRangeAddress()
oSheet.insertCells(oRangeAddress, com.sun.star.sheet.CellInsertMode.DOWN)
'Zellen mitnehmen
oRangeAddress = oSheet.getCellRangeByName(zeilen).getRangeAddress()
oCellAddress = oSheet.getCellByPosition(oColumn, 2).getCellAddress
oSheet.moveRange(oCellAddress, oRangeAddress)
oSheet.removeRange(oRangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
End Sub
Leider wird mein Doppelclick in der Tabelle nicht mehr als Befehl zum Starten des Macros ausgeführt wenn ich es in einem Writer Dokument integriert habe.
Kann mir da jemand helfen?
Calc Makro im Writer Dokument ausführen
Moderator: Moderatoren