La macro (bollettaacqua) da me creata semplicemente stiva vari dati (copia/incolla speciale) da piu fogli in un foglio riassuntivo, aggiungendo righe per renderla sequenziale nel lavoro
ok tutto perfetto, ma, devo avere una decina di macro per foglio che partano contemporaneamente (bollettaacqua01-02-03-etc.etc.....)alla pressione di un tasto (devo fare una macro che richiama le altre macro? o nel momento di assegnare la macro al bottone posso aggiungerne?)
inoltre vorrei modificare la macro "bollettaacqua01" aggiungendo una condizione: se tal cella in tal foglio ha valore diverso da 0, prosegui, se =0 spegni la macro
Codice: Seleziona tutto
REM ***** BASIC *****
Sub Main
End Sub
sub BollettaAcqua01
rem ----------------------------------------------------------------------
rem define variables
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")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Nr"
args1(0).Value = 10
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$A$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertRows", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertRows", "", 0, Array())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Nr"
args5(0).Value = 2
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "ToPoint"
args6(0).Value = "$F$6"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args6())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Nr"
args8(0).Value = 10
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args8())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "ToPoint"
args9(0).Value = "$C$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args9())
rem ----------------------------------------------------------------------
dim args10(5) as new com.sun.star.beans.PropertyValue
args10(0).Name = "Flags"
args10(0).Value = "SVD"
args10(1).Name = "FormulaCommand"
args10(1).Value = 2
args10(2).Name = "SkipEmptyCells"
args10(2).Value = false
args10(3).Name = "Transpose"
args10(3).Value = false
args10(4).Name = "AsLink"
args10(4).Value = false
args10(5).Name = "MoveMode"
args10(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args10())
rem ----------------------------------------------------------------------
dim args11(0) as new com.sun.star.beans.PropertyValue
args11(0).Name = "Nr"
args11(0).Value = 35
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args11())
rem ----------------------------------------------------------------------
dim args12(0) as new com.sun.star.beans.PropertyValue
args12(0).Name = "ToPoint"
args12(0).Value = "$C$3"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args12())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args14(0) as new com.sun.star.beans.PropertyValue
args14(0).Name = "Nr"
args14(0).Value = 10
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args14())
rem ----------------------------------------------------------------------
dim args15(0) as new com.sun.star.beans.PropertyValue
args15(0).Name = "ToPoint"
args15(0).Value = "$A$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args15())
rem ----------------------------------------------------------------------
dim args16(5) as new com.sun.star.beans.PropertyValue
args16(0).Name = "Flags"
args16(0).Value = "SVD"
args16(1).Name = "FormulaCommand"
args16(1).Value = 0
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())
rem ----------------------------------------------------------------------
dim args17(0) as new com.sun.star.beans.PropertyValue
args17(0).Name = "Nr"
args17(0).Value = 35
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args17())
rem ----------------------------------------------------------------------
dim args18(0) as new com.sun.star.beans.PropertyValue
args18(0).Name = "ToPoint"
args18(0).Value = "$D$10"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args18())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args20(0) as new com.sun.star.beans.PropertyValue
args20(0).Name = "Nr"
args20(0).Value = 10
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args20())
rem ----------------------------------------------------------------------
dim args21(0) as new com.sun.star.beans.PropertyValue
args21(0).Name = "ToPoint"
args21(0).Value = "$B$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args21())
rem ----------------------------------------------------------------------
dim args22(5) as new com.sun.star.beans.PropertyValue
args22(0).Name = "Flags"
args22(0).Value = "SVD"
args22(1).Name = "FormulaCommand"
args22(1).Value = 0
args22(2).Name = "SkipEmptyCells"
args22(2).Value = false
args22(3).Name = "Transpose"
args22(3).Value = false
args22(4).Name = "AsLink"
args22(4).Value = false
args22(5).Name = "MoveMode"
args22(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args22())
rem ----------------------------------------------------------------------
dim args23(0) as new com.sun.star.beans.PropertyValue
args23(0).Name = "ToPoint"
args23(0).Value = "$A$12:$C$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args23())
rem ----------------------------------------------------------------------
dim args24(0) as new com.sun.star.beans.PropertyValue
args24(0).Name = "Bold"
args24(0).Value = false
dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args24())
rem ----------------------------------------------------------------------
dim args25(0) as new com.sun.star.beans.PropertyValue
args25(0).Name = "ToPoint"
args25(0).Value = "$A$13"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args25())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:DeleteRows", "", 0, Array())
rem ----------------------------------------------------------------------
dim args27(0) as new com.sun.star.beans.PropertyValue
args27(0).Name = "ToPoint"
args27(0).Value = "$A$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args27())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SortAscending", "", 0, Array())
rem ----------------------------------------------------------------------
dim args29(0) as new com.sun.star.beans.PropertyValue
args29(0).Name = "Nr"
args29(0).Value = 3
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args29())
rem ----------------------------------------------------------------------
dim args30(0) as new com.sun.star.beans.PropertyValue
args30(0).Name = "ToPoint"
args30(0).Value = "$B$5"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args30())
end sub