LibreOffice Calc `Application.ScreenUpdating` code

Searching for ScreenUpdating in LibreOffice Help produced no results.

Are you able to please advise the LibreOffice Calc code equivalent of the Microsoft Excel VBA Application.ScreenUpdating?

Perhaps the Excel Application (object) needs to be referred to as something else, like LibreOffice, Calc? Could this then be used until tdf#52603 is fixed?

Code that may work with the information (and assistance of Microsoft Excel VBA Sort function which works with LibreOffice Calc without modification - #4 by sokol92) is shown below:

' Workaround for tdf#52603

Private Sub ScreenUpdatingOff()
  
#If VBA6 = 0 Then
  ' Excel ignores all statements up to #End If
  ' Please advise the LO Calc code equivalent of
  ' MS Excel VBA "Application.ScreenUpdating = False" to go
  ' on the next line. Thank you

  Exit Sub
#End If

  ' MS Excel ScreenUpdating code
  Application.ScreenUpdating = False
End Sub


Private Sub ScreenUpdatingOn()
  
#If VBA6 = 0 Then
  ' Excel ignores all statements up to #End If
  ' Please advise the LO Calc code equivalent of
  ' MS Excel VBA "Application.ScreenUpdating = True" to go
  ' on the next line. Thank you

  Exit Sub
#End If

  ' MS Excel ScreenUpdating code
  Application.ScreenUpdating = True
End Sub

Thank you

There is no exact match. You have to deal with these methods.

Sub ScreenUpdatingOff()
	With ThisComponent
		.CurrentController.Frame.ContainerWindow.Enable = False
		If Not .isActionLocked Then .AddActionLock
		If Not .hasControllersLocked Then .lockControllers
	End With
End Sub

Sub ScreenUpdatingOn()
	With ThisComponent
		If .hasControllersLocked Then .unlockControllers
		If .isActionLocked Then .removeActionLock
		.CurrentController.Frame.ContainerWindow.Enable = True
	End With
End Sub

Most of the time we use locking (lockControllers), but not everything is locked.

1 Like