Ravindra BagaleCourses & study guides

12. Macros and VBA

12.1 Developer Tab, Macro Security and .xlsm

Steps in Excel

  1. Show the Developer tab: File › Options › Customize Ribbon › in the right list tick Developer › OK. Groups: Code (Visual Basic, Macros, Record Macro, Use Relative References, Macro Security), Add-ins, Controls, XML.
  2. Macro security: Developer › Code › Macro Security (or File › Options › Trust Center › Trust Center Settings… › Macro Settings). Options:
    • Disable VBA macros without notification
    • Disable VBA macros with notification – recommended/default: a yellow bar offers Enable Content for files you trust
    • Disable VBA macros except digitally signed macros
    • Enable VBA macros – not recommended
  3. Trusted Locations (same dialog): add a folder such as D:\ExcelMacros\ – files there open with macros enabled.
  4. Save with macros: File › Save As › Save as type: Excel Macro-Enabled Workbook (*.xlsm). Saving as .xlsx deletes the code (Excel warns you).
  5. A downloaded .xlsm shows a red Security Risk bar: if you trust it, close it, right-click the file in File Explorer › Properties › tick Unblock › OK.
Format Macros? Use
.xlsx No Normal workbooks
.xlsm Yes Workbooks with macros
.xlsb Yes Binary – smaller/faster for very large files
.xlam Yes Add-ins (functions available in all workbooks)

Ravindra Bagale's Tip

Macro lihun .xlsx madhe save karne – hi khup students chi sagalyat dukhad chuk aahe, karan Excel cha warning "Yes" dabla ki poora code gayab! Pahilya macro pasunach file .xlsm madhe save kara. Ani security "Enable all macros" var thevu naka – Disable with notification ch surakshit aahe.

Practice task

Turn on the Developer tab, set a Trusted Location for your practice folder, and save a copy of Blinkit_Maharashtra as Blinkit_Macros.xlsm.