One of my clients has issue running the Excel VBA code below. He gets the following error Method 'VBE' of object '_Application' failed
, but only once, after he opens the VBE, it starts to work. Also, it was working for him until yesterday.
He is using Excel 2010.
This is the code that throws the error.
For Each f In Application.VBE.ActiveVBProject.VBComponents
If InStr(1, f.Name, "UserForm") = 1 Then
Application.VBE.ActiveVBProject.VBComponents.Remove (f)
End If
Next f