1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Sub Macro_test
dim oDoc as object, osh1 as object, osh2 as object
dim oCC as object,maplage as object,ocel as object
dim document as object, dispatcher as object
oDoc = thiscomponent
oCC = oDoc.currentcontroller
'Affiche la feuille masquée nommée "Etiqueta"
osh1 = oDoc.getsheets.getbyname("Etiqueta")
osh1.IsVisible = True
'rend le feuille Etiqueta active
oCC.activesheet = osh1
rem - 'IMPRIME LA FEUILLE ACTIVE ----------------------------------------
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:PrintDefault", "", 0, Array())
rem ----------------------------------------------------------------------
'masque le feuille Etiqueta
osh1.IsVisible = False
'active la feuille Datos
osh2 = oDoc.getsheets.getbyname ("Datos")
oCC.activesheet = osh2
'vide le contenu de A2:M2
maplage = osh2.getcellrangebyname ("A2:M2")
maplage.clearContents(com.sun.star.sheet.CellFlags.VALUE +_
com.sun.star.sheet.CellFlags.DATETIME +com.sun.star.sheet.CellFlags.STRING +_
com.sun.star.sheet.CellFlags.ANNOTATION +com.sun.star.sheet.CellFlags.FORMULA)
'sélectionne A2
ocel = osh2.getcellrangebyname("A2")
oCC.select (ocel)
End Sub |
Partager