Friday, December 30, 2016

How to inspect / view an Excel macro before "enabling macros" for a sheet?


I'm receiving occasionally an xls file that contains a macro which I should use. If I don't have complete trust in the sender, I wish to look at the macro's source in order to verify that it indeed does only what it is supposed to.


However, in Excel 2010 the "edit" button under "view macros" is disabled unless I first enable macros for the sheet - but if I first enable macros then I can, at most, find out about malicious code only after that code has finished running...


How can I view the macro's source before enabling macros for the document?


Answer



You can have a look at all macros in a document by using the Developer tab in Word to give you easy access to the Visual Basic routines embedded in the document.


First you need to make sure that the Developer Tab is enabled. Go to File -> Options then:


developer tab


On the Developer Tab that should now appear there should now be a "Visual Basic" button which you can click to get to the Visual Basic editor.


Browsing through the document tree on the left of the editor you should be able see all the code and modules that are embedded in the document without first needing to enable macros.


I tend to do this with documents I do not trust.


Note: I've done this in Word, the same feature is available in Excel and the option to enable it is in the same place.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...