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.
Sounds good -> NEW
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?
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.
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
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?