Bug 105451 - Implement VBA macro support in Impress
Summary: Implement VBA macro support in Impress
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
5.1.5.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2017-01-20 13:06 UTC by Frederic Parrenin
Modified: 2020-09-04 09:17 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Parrenin 2017-01-20 13:06:09 UTC
VBA macro is supported in Calc using the line:

Option VBASupport 1

However, VBA is apparently not working in Impress.
It would be good to support VBA in Impress as well.
Comment 1 Buovjaga 2017-01-24 12:24:14 UTC
Sounds good -> NEW
Comment 2 Buovjaga 2020-09-03 11:03:15 UTC
Alain Romedenne said today that this option is already supported in Impress.

Frederic: do you mean that PPTX files with macros are not properly interpreted when opened with Impress?
Comment 3 Frederic Parrenin 2020-09-03 12:56:58 UTC
So, in an Impress file, I created the following macro :

Option VBASupport 1
Sub Main
ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 150, 192, 168, 126).Select
End Sub

in the hope it would draw a rectangle, but I get an error:

Erreur d'exécution BASIC '91'
Variable d'objet non définie

If VBA is supported in Impress, could you give me a basic example?
Thanks.
Comment 4 Alain Romedenne 2020-09-04 08:37:40 UTC
Frederic,

LibreOffice supports VBA language to a limited extent. Two aspects are to be considered:

a- Visual Basic for Applications (VBA) language and
b- M*Office documents object model: Word, Excel, ...

a- Most of VBA language constructs are available, next to LibreOffice Basic itself. This leads to say that VBA is supported.
Refer to
https://help.libreoffice.org/latest/en-US/text/sbasic/shared/vbasupport.html for introductory information.

b- A limited set of M*Office documents properties & methods are supported under LibreOffice, as LibreOffice own model is too different M* model. However M*Office documents can be handled using LibreOffice UNO object model. M*Office model should not be expected. 

Note: Access2Base Basic library proposes a 'transposition' of M*-Access object model built upon LibreOffice API.

As for your rectangle question, I invite you to consult the wiki at https://wiki.documentfoundation.org/Macros/Impress 

With your permission I would close this incident as NOTABUG
Comment 5 Frederic Parrenin 2020-09-04 08:52:06 UTC
Dear Alain,
Thanks for the clear explanations.
I now understand the difference between VBA and M* object model.
My problem is that I give VBA courses to univ students and we use the instructions from the M* object model, like the one I gave for the rectangle.
I do not decide on the content of the courses, so I cannot change all the instructions.
So I was hoping that such instructions would be supported in LibreOffice, so that I can point the students to LibreOffice instead of M* Office.
Moreover, as you can see for the rectangle instruction, what you can do in 1 line using M* object model takes many lines using LibreOffice object model.
Would it be possible to better support M* object model?
Should I open a separate bug report?