deutsches Forum rund um Apache OpenOffice und LibreOffice
Zum Inhalt
von Jörg » Sa, 27.12.2014 12:48
von Jörg » Mo, 22.12.2014 22:04
Code: Alles auswählen
' ' ########################################################################################################## ' sub showColumnF myDoc = thisComponent mySheet = myDoc.sheets(1) myView = myDoc.CurrentController mycell = mysheet.getCellRangebyName("$E$8") mycell.formulalocal="='Eingabemaske Abr_Rechnung'.C10" mycell = mysheet.getCellRangebyName("$E$9") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C9;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$10") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C10;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$11") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C11;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$12") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C12;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$13") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C13;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$14") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C14;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$15") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C15;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$16") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C16;Patientendatei.$A$1:$J$1;0);0);"""")" mycell = mysheet.getCellRangebyName("$E$17") mycell.formulalocal= "=WENN(ZÄHLENWENN(Patientendatei.$A$2:$A$5000;$E$8);SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C17;Patientendatei.$A$1:$J$1;0);0);"""")" for i=0 to 8 mysheet.getCellByPosition(5,8+i).string ="" next oSpalte = mySheet.getcolumns().getByIndex(5) oSpalte.isVisible = true mycell = mysheet.getCellByPosition(5,8) myView.Select(mycell) oForm = mySheet.drawpage.forms.getbyindex(0) oControl = oForm.getByName("Schaltfläche 1") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 2") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 4") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 7") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 5") oControl.enablevisible = true oControl = oForm.getByName("Schaltfläche 6") oControl.enablevisible = true end sub ' ' ############################################################################ '
sub showColumnF myDoc = thisComponent mySheet = myDoc.sheets(1) mycell = mysheet.getCellrangebyName("E8") mycell.Formula = "='Eingabemaske Abr_Rechnung'.C10" dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem define variables rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem-------------------------------------------------------------------------- dim args2(0) as new com.sun.star.beans.PropertyValue args2(0).Name = "ToPoint" args2(0).Value = "$E$9" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2()) rem ---------------------------------------------------------------------- dim args3(0) as new com.sun.star.beans.PropertyValue args3(0).Name = "StringName" args3(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C9;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C9;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args3()) rem-------------------------------------------------------------------------------------------- dim args4(0) as new com.sun.star.beans.PropertyValue args4(0).Name = "ToPoint" args4(0).Value = "$E$10" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args4()) rem ---------------------------------------------------------------------- dim args5(0) as new com.sun.star.beans.PropertyValue args5(0).Name = "StringName" args5(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C10;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C10;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args5()) rem------------------------------------------------------------------------------- dim args6(0) as new com.sun.star.beans.PropertyValue args6(0).Name = "ToPoint" args6(0).Value = "$E$11" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args6()) rem ---------------------------------------------------------------------- dim args7(0) as new com.sun.star.beans.PropertyValue args7(0).Name = "StringName" args7(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C11;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C11;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args7()) rem------------------------------------------------------------------------------ dim args8(0) as new com.sun.star.beans.PropertyValue args8(0).Name = "ToPoint" args8(0).Value = "$E$12" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args8()) rem ---------------------------------------------------------------------- dim args9(0) as new com.sun.star.beans.PropertyValue args9(0).Name = "StringName" args9(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C12;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C12;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args9()) rem------------------------------------------------------------------------- dim args10(0) as new com.sun.star.beans.PropertyValue args10(0).Name = "ToPoint" args10(0).Value = "$E$13" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args10()) rem ---------------------------------------------------------------------- dim args11(0) as new com.sun.star.beans.PropertyValue args11(0).Name = "StringName" args11(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C13;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C13;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args11()) rem------------------------------------------------------------------------- dim args12(0) as new com.sun.star.beans.PropertyValue args12(0).Name = "ToPoint" args12(0).Value = "$E$14" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args12()) rem ---------------------------------------------------------------------- dim args13(0) as new com.sun.star.beans.PropertyValue args13(0).Name = "StringName" args13(0).Value = "=$M$14" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args13()) rem------------------------------------------------------------------------- dim args14(0) as new com.sun.star.beans.PropertyValue args14(0).Name = "ToPoint" args14(0).Value = "$E$15" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args14()) rem ---------------------------------------------------------------------- dim args15(0) as new com.sun.star.beans.PropertyValue args15(0).Name = "StringName" args15(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C15;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C15;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args15()) rem------------------------------------------------------------------------- dim args16(0) as new com.sun.star.beans.PropertyValue args16(0).Name = "ToPoint" args16(0).Value = "$E$16" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args16()) rem ---------------------------------------------------------------------- dim args17(0) as new com.sun.star.beans.PropertyValue args17(0).Name = "StringName" args17(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C16;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C16;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args17()) rem------------------------------------------------------------------------- dim args18(0) as new com.sun.star.beans.PropertyValue args18(0).Name = "ToPoint" args18(0).Value = "$E$17" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args18()) rem ---------------------------------------------------------------------- dim args19(0) as new com.sun.star.beans.PropertyValue args19(0).Name = "StringName" args19(0).Value = "=WENN(ISTNV(SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C17;Patientendatei.$A$1:$J$1;0);0));"""";SVERWEIS($E$8;Patientendatei.$A$2:$J$5000;VERGLEICH($C17;Patientendatei.$A$1:$J$1;0);0))" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args19()) rem get access to the document myDoc = thisComponent mySheet = myDoc.sheets(1) myView = myDoc.CurrentController for i=0 to 8 mysheet.getCellByPosition(5,8+i).string ="" next oSpalte = mySheet.getcolumns().getByIndex(5) oSpalte.isVisible = true mycell = mysheet.getCellByPosition(5,8) myView.Select(mycell) oForm = mySheet.drawpage.forms.getbyindex(0) oControl = oForm.getByName("Schaltfläche 1") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 2") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 4") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 7") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 5") oControl.enablevisible = true oControl = oForm.getByName("Schaltfläche 6") oControl.enablevisible = true end sub
von balu » So, 21.12.2014 00:16
End Sub sub kmt [...] end sub sub pa
end sub ' '############################################################################################## ' sub kmt tu was end sub ' '############################################################################################## ' sub pa just do it end sub
Habe aber inzwischen den Code zur Wiederherstellung der Formeln in Dein Makro "showColumnF" eingebaut. Jetzt ist es so wie es sein muß. Allerdings ist dieser Code sehr lang. Muß mal gucken, wie ich das anders mache.
von clag » Fr, 19.12.2014 17:03
von Jörg » Fr, 19.12.2014 14:56
von clag » Fr, 19.12.2014 14:35
Jörg hat geschrieben:In Zelle E9:E17 stehen Deine Sverweis-Formeln,
von Jörg » Fr, 19.12.2014 14:14
von clag » Fr, 19.12.2014 13:49
von Jörg » Fr, 19.12.2014 13:11
von Jörg » Fr, 19.12.2014 13:06
von clag » Fr, 19.12.2014 12:35
Jörg hat geschrieben:Sind ja über 4000 Datensätze.
von Jörg » Fr, 19.12.2014 12:15
sub neu_Kunde_anlegen dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document 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$8" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) rem ---------------------------------------------------------------------- dim args2(0) as new com.sun.star.beans.PropertyValue args2(0).Name = "StringName" args2(0).Value = "=(KGRÖSSTE(Patientendatei.A2:B5000;1))+1" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args2()) end sub
sub neuerKunde antwort = msgbox("Daten speichern?",36,"Neuer Patient") if antwort = 7 Then exit sub end if rem define variables rem --------------------------------------------------------------------- odoc = ThisComponent osheet = odoc.sheets(1) orange = osheet.getCellRangeByName("A28:J28") orangeAddress = orange.getrangeaddress odata()= orange.getdataarray oZielSheet = oDoc.sheets(0) c = oZielSheet.getCellRangeByName("A1:A5000").queryEmptyCells oZielCell = c(0).getcellbyposition(0,0) oZielCellAddress = oZielCell.getcelladdress X1=oZielCellAddress.column Y1=oZielCellAddress.row X2=oZielCellAddress.column+(orangeAddress.EndColumn-orangeAddress.StartColumn) Y2=oZielCellAddress.Row+(orangeAddress.EndRow-orangeAddress.StartRow) oZielrange=oZielSheet.getCellRangeByPosition(X1,Y1,X2,Y2) oZielrange.setdataarray(odata()) oCalc = thisComponent oSheet = oCalc.sheets(1) oCellRange = osheet.getCellRangeByName("E9:E17") ocellRange.clearContents(com.sun.star.sheet.CellFlags.VALUE) rem ---------------------------------------------------------------------- oCalc = thisComponent oSheet = oCalc.sheets(1) oCellRange = osheet.getCellRangeByName("E9:E17") ocellRange.clearContents(com.sun.star.sheet.CellFlags.STRING) rem------------------------------------------------------------------------- oCalc = thisComponent oSheet = oCalc.sheets(1) oCellRange = osheet.getCellRangeByName("E9:E17") ocellRange.clearContents(com.sun.star.sheet.CellFlags.DATETIME) end sub
sub showColumnF myDoc = thisComponent mySheet = myDoc.sheets(12) mycell = mysheet.getCellrangebyName("E8") mycell.Formula = "='Eingabemaske Abr_Rechnung'.C10" dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document myDoc = thisComponent mySheet = myDoc.sheets(12) myView = myDoc.CurrentController for i=0 to 8 mysheet.getCellByPosition(5,8+i).string ="" next oSpalte = mySheet.getcolumns().getByIndex(5) oSpalte.isVisible = true mycell = mysheet.getCellByPosition(5,8) myView.Select(mycell) oForm = mySheet.drawpage.forms.getbyindex(0) oControl = oForm.getByName("Schaltfläche 1") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 2") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 4") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 7") oControl.enablevisible = false oControl = oForm.getByName("Schaltfläche 5") oControl.enablevisible = true oControl = oForm.getByName("Schaltfläche 6") oControl.enablevisible = true end sub
von balu » Fr, 19.12.2014 12:09
habe lediglich den Tabellenindex in den Makros geändert, weil ja nun eine Tabelle mehr in der Mappe ist.
sub neuerKunde rem --------------------------------------------------------------------- odoc = ThisComponent osheet = odoc.sheets(1) orange = osheet.getCellRangeByName("A28:J28") orangeAddress = orange.getrangeaddress odata()= orange.getdataarray oZielSheet = oDoc.sheets(0) c = oZielSheet.getCellRangeByName("A1:A5000").queryEmptyCells oZielCell = c(0).getcellbyposition(0,0) oZielCellAddress = oZielCell.getcelladdress X1=oZielCellAddress.column Y1=oZielCellAddress.row X2=oZielCellAddress.column+(orangeAddress.EndColumn-orangeAddress.StartColumn) Y2=oZielCellAddress.Row+(orangeAddress.EndRow-orangeAddress.StartRow) oZielrange=oZielSheet.getCellRangeByPosition(X1,Y1,X2,Y2) oZielrange.setdataarray(odata()) oCalc = thisComponent oSheet = oCalc.sheets(1) oCellRange = osheet.getCellRangeByName("E9:E17") ocellRange.clearContents(com.sun.star.sheet.CellFlags.VALUE) rem ---------------------------------------------------------------------- oCalc = thisComponent oSheet = oCalc.sheets(1) oCellRange = osheet.getCellRangeByName("E9:E17") ocellRange.clearContents(com.sun.star.sheet.CellFlags.STRING) rem------------------------------------------------------------------------- oCalc = thisComponent oSheet = oCalc.sheets(1) oCellRange = osheet.getCellRangeByName("E9:E17") ocellRange.clearContents(com.sun.star.sheet.CellFlags.DATETIME) end sub
oSheet = thisComponent oHauptBlatt = oSheet.sheets(0) oNebenBalatt = oSheet.sheets(1)
Aber auch in deiner neuen Version ist es so, dass nach Anlegen eines Neukunden die SVerweisformeln zum Aufruf bestehender Kundendaten überschrieben werden.
von clag » Fr, 19.12.2014 10:34
von clag » Fr, 19.12.2014 10:09
sub GoCorrectData(event) .... end if call showColumnF end sub
sub GoCorrectData(event) .... call showColumnF end if end sub
Nach oben