Thursday, November 10, 2011

Excel Jasper Report with default Zoom using a Macro

I could not find a way to specify a default zoom for an Excel Report generated from iReport/Jasper Reports so I had to apply the Macro hack I recently documented.

Here is the Visual Basic for Applications code that make this possible. It zoom out the whole workbook to 75%:
Private Sub Workbook_Open()
    If Application.Sheets.Count > 1 Then
        Worksheets("Macro").Visible = False
    End If
    Application.ScreenUpdating = False

    For Each ws In Worksheets
        ws.Activate
        ActiveWindow.Zoom = 75
    Next

    Application.ScreenUpdating = True
End Sub

No comments:

Followers