How to open .xlsm file

I’m using and trying to open a .xlsm Excel file. The macros are not taken into consideration by Calc. Is there a workaround?
Best regards.

This file type, .xlsm, is a macro enabled Excel Wordbook introduced in Excel 2007. The macros are in MS VBA (Visual Basic for Applications). You will need to modify the macros to work in LO Basic.


I have created the attached Excel spreadsheet in Excel and saved it as a xlsm file. CHANGE the file extension to .xlsm after downloading.

It has a simple macro that displays a message box when the button is clicked. If you have MS Excel open it and you can see the Macro.

Open the spreadsheet in LO. Clicking the button runs the Macro which does work. You can see the Macro which is in the document at BookMacro.xlsm > VBAProject > Modules > Module1.
The macro is

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub test()
MsgBox "Test"
End Sub

LO Basic has built in a VBAModule which attempts to run VBA code. This does not always work and may need to be modified.


Modify in what way?

@GillesHT Can you see the macros in your xlsm spreadsheet? Do you get errors when you try to run them?

Yes, no problem running the macro. But when I try to add the line Option VBASupport 1 in the Excel code I get a compile error. Do I have to add the Rem line of code?

Im beginning to understand the LO macro mechanic. What I don’t understand is when I open the .xlsm file with Calc and find the macro controlled by the button and execute it the contract number gets incremented. So the macro works in LO. When I click on the button nothing. How can I post the .xlsm file?