I am trying to implement Progress bar in my Apache Open office 4.1.2 macro but getting error "Basic runtime error. Property or method not found: Dialog1."
Attached is the error screenshot.
My code is as below:
- Code: Select all Expand viewCollapse view
Sub ProgressBarDemo()
Dim oProgressBar as Object, oProgressBarModel As Object, oDialog as Object
Dim ProgressValue As Long
REM Dialog1 contains progress bar ProgressBar1 saved in standard library
DialogLibraries.loadLibrary("Standard")
oDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
REM progress bar settings
Const ProgressValueMin = 0
Const ProgressValueMax = 40
Const ProgressStep = 4
REM set minimum and maximum progress value
oProgressBarModel = oDialog.getModel().getByName( "ProgressBar1" )
oProgressBarModel.setPropertyValue( "ProgressValueMin", ProgressValueMin)
oProgressBarModel.setPropertyValue( "ProgressValueMax", ProgressValueMax)
REM show progress bar
oDialog.setVisible( True )
REM increase progress value every second
For ProgressValue = ProgressValueMin To ProgressValueMax Step ProgressStep
oProgressBarModel.setPropertyValue( "ProgressValue", ProgressValue )
Wait 1000
Next ProgressValue
End Sub