How to write a macro to open "Save New Version" dialog

I want to write a macro to do the following in LibreOffice Writer:

  1. In menu, select File
  2. Select Versions
  3. Click “Save new version” button

I have found this related answer but in that answer macro is saving a new version without opening any dialog box with an empty version comment. I don’t want this. I want to enter a version comment each time by using the dialog box.

Thank you in advance!

Hello,

Very much the same code. Only change is remove property value and change command:

sub open_version
rem ----------------------------------------------------------------------
rem define variables
    dim document   as object
    dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
    document   = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
    dim args1(0) as new com.sun.star.beans.PropertyValue
    dispatcher.executeDispatch(document, ".uno:VersionDialog", "", 0, args1())
end sub

Note: This is a dialog. It does not appear to have a method to select the OK button. Don’t have any method to execute exactly as asked for in question.

Your answer is enough. Thank you!