Bug 149722

Summary: `Macro Selector` should only show macros to Run which are “not Private” and have “no arguments passed”
Product: LibreOffice Reporter: Óvári <ovari123>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: enhancement CC: himajin100000
Priority: medium    
Version: 7.3.4.2 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: Macros.xls
MS Excel Macro Window screenshot
LO Calc Macro Selector Window screenshot

Description Óvári 2022-06-24 22:10:01 UTC
Description:
End users may `Run` macros which were programmed by others. To improve the user experience, only valid macros should be listed in the `Macro Selector` window.

Actual Results:
Macros which produce errors when run or are private can be access by the `Macro Selector`.

Expected Results:
Macros which produce errors (i.e. ones with passed arguments) when run or are private should not be shown in the `Macro Selector`.


Reproducible: Always


User Profile Reset: No



Additional Info:
`Macro Selector` should only show macros to Run which are “not Private” and have “no arguments passed”


End users may `Run` macros which were programmed by others. To improve the user experience, only valid macros should be listed in the `Macro Selector` window.

LibreOffice Calc should only showing macros that can be Run in the LO Calc `Macro Selector`.  Screenshot will be attached later.

Macros which are `Private` or are passed arguments should not be show. Inspiration from MS Excel. Screenshot will be attached later.

Code examples:

```
Private Sub PrivateFunction()
    MsgBox "This subroutine should not show in the list of macros to run as it is private"
End Sub

Sub FunctionWithArguments(intVariable As Integer)
    MsgBox "This function should not show in the list of macros to run as it is passed argument(s)"
End Sub

Sub FunctionNotPrivateNoArguments()
    MsgBox "This function should show as it is public and does not get passed any arguments"
End Sub
```

What do you think?

Thank you
Comment 1 Óvári 2022-06-24 22:11:49 UTC
Created attachment 180953 [details]
Macros.xls

MS Excel spreadsheet with 3 functions:
1. Private
2. With passed argument(s)
3. Public and no passed arguments
Comment 2 Óvári 2022-06-24 22:13:55 UTC
Created attachment 180954 [details]
MS Excel Macro Window screenshot

MS Excel only displays 1 macro which can be run, i.e. the public macro with no passed arguments.

Clicking `Run` produces no error.
Comment 3 Óvári 2022-06-24 22:17:52 UTC
Created attachment 180955 [details]
LO Calc Macro Selector Window screenshot

LO Calc displays 3 macro which can be run.

The `Private` macro can be run, which is wrong

The `Passed Argument` macro can be run, which produces an error.

Perhaps this issue should be changed from request for enhancement (RFE) to bug?

What do you think?

Thank you