Le 2005-02-26 18:35, Jacques Le Moulec a �crit :
Rebonjour,

Ci-apres une de mes 4 macros "elementaires" - les 4 sont quasi identiques :

sub EditionCalculDPU

dim document as object, dispatcher as object, PosFeuille As Object, Aediter()
dim args1(0) as new com.sun.star.beans.PropertyValue
dim args4(5) as new com.sun.star.beans.PropertyValue


document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

PosFeuille = ThisComponent.Sheets.getByName("calculDPU").getCellRangeByName("A1")
ThisComponent.getCurrentController.select(PosFeuille)


args1(0).Name = "ToPoint"
args1(0).Value = "A5:K35"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

args1(0).Name = "ToPoint"
args1(0).Value = "A44"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())

args4(0).Name = "Flags" : args4(0).Value = "A"
args4(1).Name = "FormulaCommand" : args4(1).Value = 0
args4(2).Name = "SkipEmptyCells" : args4(2).Value = false
args4(3).Name = "Transpose" : args4(3).Value = false
args4(4).Name = "AsLink" : args4(4).Value = true
args4(5).Name = "MoveMode" : args4(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args4())

ThisComponent.Print(Aediter())

args1(0).Name = "Flags"
args1(0).Value = "A"
dispatcher.executeDispatch(document, ".uno:Delete", "", 0, args1())

args1(0).Name = "BackgroundColor"
args1(0).Value = 11776947
dispatcher.executeDispatch(document, ".uno:BackgroundColor", "", 0, args1())


end sub


Il suffit de modifier le d�but du codage pour initialiser Aediter avec l'option Wait.


dim document  as object, dispatcher as object, PosFeuille As Object
dim Aediter(0) as new com.sun.star.beans.PropertyValue
dim args1(0) as new com.sun.star.beans.PropertyValue
dim args4(5) as new com.sun.star.beans.PropertyValue

Aediter(0).Name = "Wait"
Aediter(0).Value = True

' - - le reste est inchang� - -

R�f�rence : livre Programmation OpenOffice.org, page 176.
Bon week-end
   Bernard


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Répondre à