While answers from Mokubai and hBy2Py seem great and indeed do allow you to show the VBA Editor, it seems that at least in Excel from Microsoft Office Professional Plus 2016 still doesn't let you view the code.
I happen to own that version, and I was sure I received a malicious XLS and wanted to inspect it. After opening it in Excel, it opened up in safe mode as usual and of course I had no intention of dismissing that mode. When I opened up VBA Editor as other respondents indicated, I was presented with ... empty VBA Editor. "Project explorer" panel helpfully displayed "No open projects" despite I have not closed the XLS file yet. Just for the sake of testing, I opened second document (one of my work) and it immediatelly showed up in VBA Editor and was (properly) totally devoid of any VBA. However, the document from the internet was not listed in the VBA Editor.
I wasted some time trying to figure out why is that so, and found no reason. It seems that my Excel edition simply does not send VBA modules to the VBA Editor when document is loaded in safe mode. Sadly, VBA Editor lacks some "open VBA from Office Document" feature, so it's clear that the Excel is the brain here and it has to unpack/decode/whatever the XLS first.
Solution turned out to be quite simple.
- Click
Ribbon
->Developer
->MacroSecurity
- alternatively,
File
->Options
->SecurityCenter
(last option group)->Settings
->Macros
)
- Remember (or write down) what are the current settings
- Change them to "Block all macros without notification"
- Confirm, close, reopen the document, reopen VBA Editor
- Restore original the settings while you finished playing with fire
Effects:
- notification didn't show up
- document has been fully loaded
- no macros were executed
- VBA Editor got the modules and presented all the code
In case you are curious: yes, it indeed was malicious, tiny example:
Function marcopoloko()
marcopoloko = Left("CM to inches converter", 2) + Right("fed.ex", 4) + "e " + "/c" + numneroop + amagilocard
End Function
'Sub Workbook_Open()
'If xlTickMarkOutside > 0 Then
'Shell marcopoloko + """", xlXmlExportSuccess
'End If
'End Sub
BTW. as you can see I immediatelly commented out the entry point and re-saved the document, in case I allow the macros to run at some point of time later.