Ask Your Question

How to open .xlsm file [closed]

asked 2016-05-13 18:52:01 +0200

GillesHT gravatar image

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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by GillesHT
close date 2016-05-15 19:15:21.071763

1 Answer

Sort by » oldest newest most voted

answered 2016-05-13 23:13:11 +0200

peterwt gravatar image

updated 2016-05-14 18:48:37 +0200

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.

edit flag offensive delete link more


Modify in what way?

GillesHT gravatar imageGillesHT ( 2016-05-14 16:44:11 +0200 )edit

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

peterwt gravatar imagepeterwt ( 2016-05-14 19:18:21 +0200 )edit

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?

GillesHT gravatar imageGillesHT ( 2016-05-14 20:26:39 +0200 )edit

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?

GillesHT gravatar imageGillesHT ( 2016-05-14 21:56:06 +0200 )edit

Question Tools

1 follower


Asked: 2016-05-13 18:52:01 +0200

Seen: 7,243 times

Last updated: May 14 '16