Rubberduck
Rubberduck copied to clipboard
Inspection for Use of New keyword for non-creatable class
Some CoClasses don't have public constructors, so VBA can't New 'em up.
Set myWorkbook = New Workbook
With New Workbook
Beep
End With
The quickfix would require knowing the factory method(s) and be host/TLB specific.
Set myWorkbook = Workbooks.Add
With Workbooks.Add
Beep
End With