I'm trying to use VBA to open files that potentially have password protected macros. Below code can successfully detect the files with macros that have NO password, but fail to pick up the files with password protected macros. Any suggestions on how can I fix it? 

```
Dim wb As Workbook
Set wb = Application.Workbooks.Open(EUC_Path, UpdateLinks:=False)
If wb.VBProject.VBComponents.Count > 0 Then
    ThisWorkbook.Worksheets(1).Range("F" & i).Value = "Yes"
Else
    ThisWorkbook.Worksheets(1).Range("F" & i).Value = "No"
End If

```

Thanks in advance.

---

Update: I realize that my above description wasn't very clear but my final goal is to actually read the number of lines in each macro, after determine whether the worksheet has macro to begin with. My code to check the number of lines is: 

```
With wb.VBProject
    Number_Macro = 0
    For k = 1 To .VBComponents.Count
        Line_Count = .VBComponents.Item(k).CodeModule.CountOfLines
    next k
End with

```

Thus instead of detecting macro protection through error message, I have to be able to have a real access to the macro that is password protected. Can someone please advise me on that?

Thanks