I wrote the next macro, but isn't working.
For example: I have a button on the sheet (invoerblad) for printing, the button must print the sheet (Printblad), and when the print action is finished, it should return to the sheet (invoerblad).
function PrintSummary() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet().getName()
var tempRange = ss.getSheetByName("Printblad").getRange(1,1, ss.getLastRow(), ss.getLastColumn());
var bottomBuffer = 46; // The amount of rows at the bottom of the sheet to ignore
var rightBuffer = 4; // The amount of rows at the right of the sheet to ignore
var numRows = tempRange.getNumRows() - bottomBuffer;
var numCols = tempRange.getNumColumns() - rightBuffer;
var range = ss.getSheetByName("Printblad").getRange(1,1, ss.getLastRow(), ss.getLastColumn());
range.activate()
// Run print operation
// Options: Selection
// No Gridlines
// Paper Size: A4
// Layout: Fit to Width
// Landscape
}
What am I doing wrong?