Question posted 2011 · +4 upvotes
Is there a compatibility issue between macros written for XLS, XLSX and XLSM? Will the same macro work for all workbooks?
Accepted answer +7 upvotes
There are significant differences between these formats :
.XLSis intended to be used for Excel 2003 and above, so your VBA code needs to be backwards compatible for earlier versions of Excel (<2007).XLSXis the Excel 2007 format that cannot store VBA code..XLSMor.XLSBare the Excel 2007 format that allow you to save VBA code with the workbook. As Sydenam said, the differences between these two is the way the workbook is stored.
In short: .XLSB is the binary format (equivalent to .XLS for 2007+ version) whereas .XLSM is the OOXML format.
See In which case should we use the xlsm or the xlsb format? for more information.
Addendum for backward compatibility
I can’t see any easy way to tell you how it can be backwards compatible, we can’t be that generic. You can see on Ozgrid the new methods and properties that were added in Excel 2007. You can also find here some tips on how to develop on Excel 2007.
The Ozgrid page will give you the new elements of Excel 2007 and then will tell you what you shouldn’t use if you wanted to be backwards compatible.
External references cited (4)
- en.wikipedia.org — OOXML
- stackoverflow.com — In which case should we use the xlsm or the…
- ozgrid.com — Ozgrid
- fontstuff.com — here
Top vba Q&A (6)
- Difference between Visual Basic 6.0 and VBA +122 (2009)
- VBA – how to conditionally skip a for loop iteration +116 (2011)
- VBA: Test if string begins with a string? +53 (2013)
- html parsing of cricinfo scorecards +47 (2012)
- Code to loop through all records in MS Access +46 (2011)
- Access VBA | How to replace parts of a string with another string +44 (2011)
vba solutions on this site
.