How a macro in the template got saved in new file created using this template?

I have a calc template (ots) with a macro stored in it. When I create a new file using this template, I can use macro in it. But when I save the new file in xls format, the macro is not getting saved. That means when the new file is reopened after saving and closing, the macro is not there. Can I get a solution other than saving the file as ods?

Just tested it and couldn’t verify this. My document created from an ots containing a macro worked fine after saving, closing and reloading (LibreOffice 4.3.2 Calc under Win 8.1). The file derived from the template obviously contains the macro. The macro is functional and can also be edited.

Oh…I am saving the file in xls format. That may be the problem. Edited the question accordingly.

Use ‘.ods’ together with ‘.odt’ or quit programming macros.
(I don’t use Excel for many years now and I have no access for testing. But: Excel comes with it’s specific macro language VBA and does not support other styles/languages/APIs. You cannot expect a ‘Star’BASIC’ piece of code to pass twice through MS oriented filters and still work.)

Editing:

Did you compare the code as you find it in the reopened ‘.XLS’ with that one placed in the ‘.OTS’ ?

@lupp Thankyou for answering. No code is getting saved in xls format. I am using xls format because I want to open the file in my android device too. I cant find a good app for android to open ods sheets.