Zeiterfassung

Programmierung unter AOO/LO (StarBasic, Python, Java, ...)

Moderator: Moderatoren

Bembel
*
Beiträge: 14
Registriert: Fr, 01.10.2004 08:14
Wohnort: Breidenbach

Zeiterfassung

Beitrag von Bembel »

Hallo aus Breidenbach

Habe ein Makro von Base zusammen geflickt.

sub speichern
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
Meldung = "Haben Sie Ihre diverse Zeiten eingegeben ?"
DialogArt = 260
Titel = "Hinweis"
Anwt = MsgBox(Meldung, DialogArt, Titel)

If Anwt = 7 Then
myDoc = ThisComponent
myView = myDoc.CurrentController
mySheet = myDoc.Sheets.getByName("Diverse")
myView.setActiveSheet(mySheet)
oCtl = myDoc.getCurrentController
oSheet = oCtl.ActiveSheet
oCell = oSheet.getCellRangeByName("F14")
oCtl.select(oCell)
Else
Anwt = 6
myDoc = ThisComponent
oCtl = myDoc.getCurrentController
oSheet = oCtl.ActiveSheet
-----
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$E$52:$AG$52"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
myDoc = ThisComponent
myView = myDoc.CurrentController
mySheet = myDoc.Sheets.getByName("Datenbank")
myView.setActiveSheet(mySheet)
oCtl = myDoc.getCurrentController
oSheet = oCtl.ActiveSheet
oCell = oSheet.getCellRangeByName("$A$5")
oCtl.select(oCell)
dim args5(5) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Flags"
args5(0).Value = "SVDN"
args5(1).Name = "FormulaCommand"
args5(1).Value = 0
args5(2).Name = "SkipEmptyCells"
args5(2).Value = false
args5(3).Name = "Transpose"
args5(3).Value = false
args5(4).Name = "AsLink"
args5(4).Value = false
args5(5).Name = "MoveMode"
args5(5).Value = 0
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args5())
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "ToPoint"
args6(0).Value = "$A$5"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args6())
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "NumberFormatValue"
args7(0).Value = 160
dispatcher.executeDispatch(document, ".uno:NumberFormatValue", "", 0, args7())
myDoc = ThisComponent
myView = myDoc.CurrentController
mySheet = myDoc.Sheets.getByName("Datenbank")
myView.setActiveSheet(mySheet)
oCtl = myDoc.getCurrentController
oSheet = oCtl.ActiveSheet
oCell = oSheet.getCellRangeByName("$B$5:$AC$5")
oCtl.select(oCell)
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "HorizontalJustification"
args2(0).Value = com.sun.star.table.CellHoriJustify.RIGHT
dispatcher.executeDispatch(document, ".uno:HorizontalJustification", "", 0, args2())
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "NumberFormatValue"
args3(0).Value = 2
dispatcher.executeDispatch(document, ".uno:NumberFormatValue", "", 0, args3())
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Nr"
args8(0).Value = 4
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args8())
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "ToPoint"
args9(0).Value = "$H$52"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args9())

dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
dim args11(0) as new com.sun.star.beans.PropertyValue
args11(0).Name = "ToPoint"
args11(0).Value = "$I$8"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args11())

dim args12(5) as new com.sun.star.beans.PropertyValue
args12(0).Name = "Flags"
args12(0).Value = "SVDN"
args12(1).Name = "FormulaCommand"
args12(1).Value = 1
args12(2).Name = "SkipEmptyCells"
args12(2).Value = false
args12(3).Name = "Transpose"
args12(3).Value = false
args12(4).Name = "AsLink"
args12(4).Value = false
args12(5).Name = "MoveMode"
args12(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args12())
dim args13(0) as new com.sun.star.beans.PropertyValue
args13(0).Name = "ToPoint"
args13(0).Value = "$J$52"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args13())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
dim args15(0) as new com.sun.star.beans.PropertyValue

args15(0).Name = "ToPoint"
args15(0).Value = "$H$8"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args15())

dim args16(5) as new com.sun.star.beans.PropertyValue
args16(0).Name = "Flags"
args16(0).Value = "SVDN"
args16(1).Name = "FormulaCommand"
args16(1).Value = 2
args16(2).Name = "SkipEmptyCells"
args16(2).Value = false
args16(3).Name = "Transpose"
args16(3).Value = false
args16(4).Name = "AsLink"
args16(4).Value = false
args16(5).Name = "MoveMode"
args16(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args16())
dim args17(0) as new com.sun.star.beans.PropertyValue
args17(0).Name = "ToPoint"
args17(0).Value = "$H$7"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args17())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
dim args19(0) as new com.sun.star.beans.PropertyValue
args19(0).Name = "ToPoint"
args19(0).Value = "$H$8"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args19())
dim args20(5) as new com.sun.star.beans.PropertyValue
args20(0).Name = "Flags"
args20(0).Value = "SVDN"
args20(1).Name = "FormulaCommand"
args20(1).Value = 1
args20(2).Name = "SkipEmptyCells"
args20(2).Value = false
args20(3).Name = "Transpose"
args20(3).Value = false
args20(4).Name = "AsLink"
args20(4).Value = false
args20(5).Name = "MoveMode"
args20(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args20())
dim args21(0) as new com.sun.star.beans.PropertyValue
args21(0).Name = "ToPoint"
args21(0).Value = "$C$14"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args21())
end if
end sub

An dem Makro fehlt noch folgendes : Wenn im Tabellenblatt (Einstellung „D 23“)ein „nein“
steht, soll die Summe aus dem Tabellenblatt( Diverse „H45“) in das Tabellenblatt ( Zeiterfassung „I8“
eigefügt werden . Bei einem „ja“ im Tabellenblatt (Einstellung „D 23“)soll die Summe aus dem
Tabellenblatt (Diverse „H45“) in das Tabellenblatt (Datenbank „M5“ eingefügt werden.


wie sollte es auch anders sein, keine Fehlermeldung und keine Funktion.
Von Sub Speichen bis oSheet = oCtl.ActiveSheet ist es OK,die Meldung kommt
und wenn der Buton „nein „ angeklickt wird erscheint das Tabellenblatt „Diverse“.
Der Rest läuft nicht.
Wer kann mir helfen ? javascript:emoticon(':shock:')

Habe OO 2.0

Grüße aus Breidenbach