You need to insure that it won't do anything autonomously. Macro can execute autonomously if they respond to certain events. Fortunate we can inhibit this kind of autonomous behavior.
Say, for example, that we wish to examine the VBA coding within DontCrossTheStreams.xlsm
. Rather than opening the file by double-clicking, we use a short macro to open the file:
Sub OpenSafely()
Application.EnableEvents = False
Workbooks.Open Filename:="DontCrossTheStreams.xlsm"
End Sub
Macros are very easy to install and use:
- Alt+F11 brings up the VBE window
- Alt+I. Alt+M opens a fresh module
- paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
If you are using a version of Excel later then 2003, you must save
the file as .xlsm
rather than .xlsx
.
To remove the macro:
- bring up the VBE window as above
- clear the code out
- close the VBE window
To use the macro from the Excel window:
- Alt+F8
- Select the macro
- Touch RUN
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
Macros must be enabled for this to work!
(but once the suspect workbook is opened, events will be disabled)