Calc macro to toggle 'PagebreakMode' on and off

Is it possible to toggle ‘normal’ and ‘page break’ view using a Basic macro?

Hello @Kunjomachen,

Yes that’s possible using a macro such as the following:

Global g_IsPageBreakViewActive As Boolean		REM Bareuh: the ViewData.ShowPageBreakPreview property seems to be unused...
Sub TogglePageBreakView()
REM This toggles the current Page View in Calc, between "Normal View" and "Page Break Preview".
REM Uses a Global boolean g_IsPageBreakViewActive declared outside of this method.
	Dim oDispatcher As Object : oDispatcher = createUnoService( "com.sun.star.frame.DispatchHelper" )
	
	If g_IsPageBreakViewActive Then
		oDispatcher.executeDispatch( ThisComponent.CurrentController.Frame, ".uno:NormalViewMode", "", 0, Array())
	Else
		oDispatcher.executeDispatch( ThisComponent.CurrentController.Frame, ".uno:PagebreakMode", "", 0, Array() )
	End If
	g_IsPageBreakViewActive = Not g_IsPageBreakViewActive
	
End Sub