Printing all sheets from a macro

Hello,
I just migrated from Open Office. So far, migration has been smooth in spite of the large collection of macros I had produced over the years.

Here is one thing that OO was unable to do, and that LO might support. Is there a way to behave as if the PrintDialog has been called with the “Print all sheets” selected from a macro without, of course, showing the Print dialog?

Cheers,

Didier

Try this:

Sub PrintAllSheets
 Dim opts(0) as new com.sun.star.beans.PropertyValue	
 Dim oDoc As Object
 oDoc=ThisComponent
 
 With createUnoService("com.sun.star.frame.DispatchHelper")  
   .executeDispatch(oDoc.CurrentController.Frame, ".uno:TableSelectAll", "", 0, Array())
   opts(0).Name="Wait"
   opts(0).Value=True
   oDoc.Print opts   
   .executeDispatch(oDoc.CurrentController.Frame, ".uno:TableDeselectAll", "", 0, Array())
 End With   

End Sub

1 Like

Thanks! That did the trick.
Cheers,
Didier

some options from : Calc print macro