Breadcrumbs

VBA commands for NX: UnhideAllAsync

Visual Basic for Applications macros are not supported by Excel Online.

Description

Asynchronous command that shows all rows and columns that are hidden.

See Introduction to Velixo NX VBA commands for general usage information.

Syntax

objVelixo.UnhideAllAsync


objVelixo - A variable that represents an instance of the Velixo_NX_Tools VBA command class.Arguments.

UnhideAllAsync is especially useful when used together with HideZeroRowsAsync or HideZeroColumnsAsync. See example for more detail.

Examples

Simple usage

Using UnhideAllAsync only:

Dim velixoObj As Velixo_NX_Tools.VBA
Set velixoObj = CreateObject("Velixo.NX.Tools.Vba")

velixoObj.UnhideAllAsync


Common usage

A common use case is to run UnhideAllAsync, update some data, and (re)apply HideZeroRowsAsync and/or Columns to one or many predefined ranges. As the commands are asynchronous, they need to be separated by callbacks to ensure sequential execution.

Public Sub ProcessTrialBalance()
    Dim velixoObj As Velixo_NX_Tools.VBA
    Set velixoObj = CreateObject("Velixo.NX.Tools.Vba")

    Dim noArgs() As Variant
    velixoObj.AddOperationCompleteCallback ActiveWorkbook, VbaCommandName_UnhideAll, "ShowStatusUnhideAllAsync", noArgs

    velixoObj.UnhideAllAsync
End Sub

Public Sub ProcessUpdateAndHideZeros()
    Worksheets("Trial Balance").Range("C7").Value = "'12-2022"

    Dim velixoObj As Velixo_NX_Tools.VBA
    Set velixoObj = CreateObject("Velixo.NX.Tools.Vba")

    Dim noArgs() As Variant
    velixoObj.AddOperationCompleteCallback ActiveWorkbook, VbaCommandName_HideZeroRows, "ShowStatusHideZeroRowsAsync", noArgs

    velixoObj.HideZeroRowsAsync Worksheets("Trial Balance").Range("D13:G172")
End Sub

Separate module containing callbacks:

Public Sub ShowStatusUnhideAllAsync()
    MsgBox "All rows unhidden"

    Dim velixoObj As Velixo_NX_Tools.VBA
    Set velixoObj = CreateObject("Velixo.NX.Tools.Vba")

    Dim noArgs() As Variant
    velixoObj.RemoveOperationCompleteCallback ActiveWorkbook, VbaCommandName_UnhideAll, "ShowStatusUnhideAllAsync", noArgs

    ProcessUpdateAndHideZeros
End Sub

Public Sub ShowStatusHideZeroRowsAsync()
    MsgBox "Zero rows hidden"

    Dim velixoObj As Velixo_NX_Tools.VBA
    Set velixoObj = CreateObject("Velixo.NX.Tools.Vba")

    Dim noArgs() As Variant
    velixoObj.RemoveOperationCompleteCallback ActiveWorkbook, VbaCommandName_HideZeroRows, "ShowStatusHideZeroRowsAsync", noArgs
End Sub