View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
BOSS BOSS is offline
external usenet poster
 
Posts: 123
Default Detect macro in excel file without opening it

Actually i need to scan my c:\ drive and get a report that how many files
contains macros and how many does not!!

I open all the files one by one using Workbooks.Open (FileItem) methd...

Then i check does it contains macros using

For Each m In ActiveWorkbook.VBProject.VBComponents
If m.Type = 1 Then ckhcode = 5
Next m

I need to do this without opening the file, because sometimes the files
contains links to other files etc etc... and the macro hangsup...

please advise..

Gaurav



"Javed" wrote:

On Apr 28, 3:01 pm, Boss wrote:
Is it possible to detect if an excel file contains macros without opening it.
please advise.. thx! - Boss


In Excel 2007 if a workbook contains macro it's extension will be xlsm
In excel 2003 no such way.For avoiding macro virus you can set the
tools-Option-security-macro security- to low so that no macro is run.
.