möchte aufgezeichnetes makro mehrmals ausführen

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

Moderator: Moderatoren

suedfinne
*
Beiträge: 10
Registriert: So, 04.03.2007 21:33

möchte aufgezeichnetes makro mehrmals ausführen

Beitrag von suedfinne »

wie kann ich eine schleife in einem aufgezeichnetest makro einfügen? ich muß ein makro mal so 300 bis 600 mal aufrufen und das per hand wäre etwas langweilig.. grins bitte um hilfe
Karolus
********
Beiträge: 7517
Registriert: Mo, 02.01.2006 19:48

Beitrag von Karolus »

Hallo

Ein Schuss ins Blaue (mangels Informationen ohne Gewähr) :

Sub oefters
do
while i < 601
deine aufzeichnung ohne Anfangs- und Endzeile
i = i + 1
loop
end sub

Gruß Karo
suedfinne
*
Beiträge: 10
Registriert: So, 04.03.2007 21:33

Beitrag von suedfinne »

hmm er sagt basic syntaxfehler
noch offener anweisungsblock wend fehlt..

hier mal mein makro mit deinem vorschlag.


Sub protosort
do
while i < 601
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 = "ToPoint"
args1(0).Value = "$A$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Nr"
args3(0).Value = 2

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args3())

rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "ToPoint"
args4(0).Value = "$A$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args4())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())

rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Nr"
args6(0).Value = 1

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args6())

rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "ToPoint"
args7(0).Value = "$A$3"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args7())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "Nr"
args9(0).Value = 2

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args9())

rem ----------------------------------------------------------------------
dim args10(0) as new com.sun.star.beans.PropertyValue
args10(0).Name = "ToPoint"
args10(0).Value = "$B$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args10())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())

rem ----------------------------------------------------------------------
dim args12(0) as new com.sun.star.beans.PropertyValue
args12(0).Name = "Nr"
args12(0).Value = 1

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args12())

rem ----------------------------------------------------------------------
dim args13(0) as new com.sun.star.beans.PropertyValue
args13(0).Name = "ToPoint"
args13(0).Value = "$A$7"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args13())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args15(0) as new com.sun.star.beans.PropertyValue
args15(0).Name = "Nr"
args15(0).Value = 2

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args15())

rem ----------------------------------------------------------------------
dim args16(0) as new com.sun.star.beans.PropertyValue
args16(0).Name = "ToPoint"
args16(0).Value = "$C$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args16())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())

rem ----------------------------------------------------------------------
dim args18(0) as new com.sun.star.beans.PropertyValue
args18(0).Name = "Nr"
args18(0).Value = 1

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args18())

rem ----------------------------------------------------------------------
dim args19(0) as new com.sun.star.beans.PropertyValue
args19(0).Name = "ToPoint"
args19(0).Value = "$A$8"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args19())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args21(0) as new com.sun.star.beans.PropertyValue
args21(0).Name = "Nr"
args21(0).Value = 2

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args21())

rem ----------------------------------------------------------------------
dim args22(0) as new com.sun.star.beans.PropertyValue
args22(0).Name = "ToPoint"
args22(0).Value = "$D$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args22())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())

rem ----------------------------------------------------------------------
dim args24(0) as new com.sun.star.beans.PropertyValue
args24(0).Name = "Nr"
args24(0).Value = 1

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args24())

rem ----------------------------------------------------------------------
dim args25(0) as new com.sun.star.beans.PropertyValue
args25(0).Name = "ToPoint"
args25(0).Value = "$A$9"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args25())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args27(0) as new com.sun.star.beans.PropertyValue
args27(0).Name = "Nr"
args27(0).Value = 2

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args27())

rem ----------------------------------------------------------------------
dim args28(0) as new com.sun.star.beans.PropertyValue
args28(0).Name = "ToPoint"
args28(0).Value = "$E$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args28())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())

rem ----------------------------------------------------------------------
dim args30(0) as new com.sun.star.beans.PropertyValue
args30(0).Name = "Nr"
args30(0).Value = 1

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args30())

rem ----------------------------------------------------------------------
dim args31(0) as new com.sun.star.beans.PropertyValue
args31(0).Name = "ToPoint"
args31(0).Value = "$A$10"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args31())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args33(0) as new com.sun.star.beans.PropertyValue
args33(0).Name = "Nr"
args33(0).Value = 2

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args33())

rem ----------------------------------------------------------------------
dim args34(0) as new com.sun.star.beans.PropertyValue
args34(0).Name = "ToPoint"
args34(0).Value = "$F$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args34())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())

rem ----------------------------------------------------------------------
dim args36(0) as new com.sun.star.beans.PropertyValue
args36(0).Name = "Nr"
args36(0).Value = 1

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args36())

rem ----------------------------------------------------------------------
dim args37(0) as new com.sun.star.beans.PropertyValue
args37(0).Name = "ToPoint"
args37(0).Value = "$A$15"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args37())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args39(0) as new com.sun.star.beans.PropertyValue
args39(0).Name = "Nr"
args39(0).Value = 2

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args39())

rem ----------------------------------------------------------------------
dim args40(0) as new com.sun.star.beans.PropertyValue
args40(0).Name = "ToPoint"
args40(0).Value = "$G$1"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args40())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertRows", "", 0, Array())

rem ----------------------------------------------------------------------
dim args43(0) as new com.sun.star.beans.PropertyValue
args43(0).Name = "Nr"
args43(0).Value = 1

dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args43())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:DeleteRows", "", 0, Array())

i = i + 1
loop


end sub
hol.sten
******
Beiträge: 871
Registriert: Fr, 18.11.2005 21:21

Beitrag von hol.sten »

suedfinne hat geschrieben:hmm er sagt basic syntaxfehler
noch offener anweisungsblock wend fehlt..
Versuche den Teil mit der While-Schleife so (do while i < 601 in einer Zeile):

Code: Alles auswählen

do while i < 601
deine aufzeichnung ohne Anfangs- und Endzeile 
i = i + 1
loop
oder so (loop while i < 601 in einer Zeile):

Code: Alles auswählen

do
deine aufzeichnung ohne Anfangs- und Endzeile 
i = i + 1
loop while i < 601
oder so (mit wend statt do ... loop):

Code: Alles auswählen

while i < 601
deine aufzeichnung ohne Anfangs- und Endzeile 
i = i + 1
wend
Regards
hol.sten
suedfinne
*
Beiträge: 10
Registriert: So, 04.03.2007 21:33

Beitrag von suedfinne »

juhu das geht... danke für die schnelle hilfe!!
gruß gunnar
Antworten