Hi,
As far as I know, if the files include some macros, they are usually saved as XLSM format. Thus, we may filter this format by using Windows 8's File Explorer first. But, not all the XLSM files have the macros, we may use some VBA function to do further filter.
Sample code
One:
Function FoundMarco(f) As Boolean
Dim vbc As VBComponent, i As Long
Dim wbk As Workbook
Application.EnableEvents = False
Set wbk = Workbooks.Open(f)
FoundMarco = False
For Each vbc In wbk.VBProject.VBComponents
With vbc.CodeModule
For i = 1 To .CountOfLines
If .ProcOfLine(i, vbext_pk_Get) <> "" Or _
.ProcOfLine(i, vbext_pk_Let) <> "" Or _
.ProcOfLine(i, vbext_pk_Proc) <> "" Or _
.ProcOfLine(i, vbext_pk_Set) <> "" Then
FoundMarco = True
Exit For
End If
Next
End With
If FoundMarco Then Exit For
Next
Application.EnableEvents = True
wbk.Close
End Function
Two:
Public Function blnCod() As Boolean
Dim j As Integer
For j = 1 To ActiveWorkbook.VBProject.VBComponents.Count
If ActiveWorkbook.VBProject.VBComponents(j).CodeModule.CountOfLines > 2 Then
blnCod = True
Exit For
End If
Next j
End Function
If you have any further question about using VBA function, I recommend you post the question to MSDN forum:
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
George Zhao
TechNet Community Support