Bug 161495 - VBA supported data model is not documented
Summary: VBA supported data model is not documented
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.2.4.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0
Keywords:
Depends on:
Blocks: Macro-VBA Macro-Documentation
  Show dependency treegraph
 
Reported: 2024-06-10 14:09 UTC by Alain Romedenne
Modified: 2024-07-06 19:31 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
May be save as a functioning .ODS document (49.75 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2024-06-10 14:53 UTC, Alain Romedenne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alain Romedenne 2024-06-10 14:09:03 UTC
Description:
Imported MS-Office files with macros are supported to a limited extent that is not publicly available. It would be good to distinguish the exact extent to which MS-VBA imported macros are supported.

Steps to Reproduce:
MS-VBA imported modules are set with a special attribute that enables MS-Office or ODF files to execute MS-VBA extra features 

Actual Results:
Describe MS-VBA data model enablement for ODF documents 

Expected Results:
Run either LibreOffice BASIC either MS-VBA in ODF files either both


Reproducible: Always


User Profile Reset: No

Additional Info:
Supported data model can be infered from https://git.libreoffice.org/core/+/refs/heads/master/oovbaapi/ .IDL source files.
Comment 1 Alain Romedenne 2024-06-10 14:53:21 UTC
Created attachment 194633 [details]
May be save as a functioning .ODS document
Comment 2 Alain Romedenne 2024-06-10 15:34:11 UTC
Unfinished example help page:
https://help.libreoffice.org/24.8/en-US/text/sbasic/shared/exportasfixedformat.html?&DbPAR=SHARED

This method cannot be executed as such, its module requires a special attribute for it to work. A dedicated MS-VBA data model new help page may reference all MS-VBA special features.

Original patch:
https://bugs.documentfoundation.org/show_bug.cgi?id=149786

Documentation can be infered from .IDL files:
https://git.libreoffice.org/core/+/refs/heads/master/oovbaapi/
Comment 3 Rafael Lima 2024-06-10 17:28:37 UTC
I agree that this can be better documented. I for one do not know a lot about the internals of VBASupport.

The list of all supported functions (that are documented) can ben found here:
https://help.libreoffice.org/24.8/en-US/text/sbasic/shared/special_vba_func.html
Comment 4 Stéphane Guillou (stragu) 2024-06-25 14:44:07 UTC
We have:
- VBA Properties: https://help.libreoffice.org/latest/lo/text/shared/optionen/01130100.html
- Working with VBA Macros: https://help.libreoffice.org/latest/lo/text/sbasic/shared/vbasupport.html
- Option VBASupport Statement: https://help.libreoffice.org/latest/lo/text/sbasic/shared/03103350.html
- Exclusive VBA Functions and Statements (as Rafael linked already): https://help.libreoffice.org/latest/en-US/text/sbasic/shared/special_vba_func.html

Reports of 423 errors are collected in bug 144453.

Alain, just to clarify: your request is to have better coverage of supported VBA functions / methods / properties in our Help pages, is that correct? And your comment 2 is just one example of how our documentation is lacking?

It might help - after you have reviewed the help pages I linked above - if you could list exactly what you think is still missing / still needs fixing.

Thank you!
Comment 5 Alain Romedenne 2024-06-28 13:32:40 UTC
Hi Stéphane,

1. The purpose of this bug report is to better document VBA Objects - properties & methods - proposed by MSOffice VBA data model. Some VBA objects are accessible when reading MSOffice docs in LibO and can be executed or modified under certain - yet unprecised enough - conditions.

2. VBA functions currently documented are extending Lib BASIC language with utility methods that solely require 'Option VBASupport 1' preliminary statement. This statement does not allow the access to former VBA Objects.

<obj>.ExportAsFixedFormat() method falls into category 1. This method requires to instantiate VBA objects to be used, hence its documentation is partial/incorrect.

Using VBASupport'd functions next to libO BASIC may cause runtime hickups as per this post: 
https://ask.libreoffice.org/t/what-are-possible-negative-consequences-of-enabling-vba-support/101170/3

However, documenting supported VBA objects properties & methods - next to VBA functions - will precise VBA data model supported scope, thus easing MSOffice docs conversion to LibreOffice.

Hoping this clarifies !
Comment 6 Stéphane Guillou (stragu) 2024-06-28 14:11:00 UTC
Thanks Alain!
Let's set to "new" then. Clearly lacking in documentation, record of what is actually supported, and completeness of existing examples.
Comment 7 Alain Romedenne 2024-07-05 14:24:15 UTC
Valuable unit test documents can be found at https://opengrok.libreoffice.org/xref/core/sc/qa/extras/testdocuments/ in order to enrich 'VBA supported objects' planned help page
Comment 8 Commit Notification 2024-07-06 19:31:58 UTC
Alain Romedenne committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/e859581bf5302296634127cd7bb6576f6e3ec932

tdf#149786 tdf#161495 VBA objects & properties & methods (WiP)