This project has moved. For the latest updates, please go here.
When referencing COM Automation collections late-bound, the enumeration via For Each does not automatically work. An explicitly cast or set to a variable of type IEnumerable will work, though:

        Dim app As Object = ExcelDnaUtil.Application

        Dim sh As Object
        Dim flg As Boolean

        For Each sh In CType(app.Worksheets, IEnumerable)
            ' Do stuff with sh here
        Next


This should not be needed if an interop library is referenced.

Last edited May 27, 2013 at 11:42 AM by govert, version 2