For each ... Next Question

  • Thread starter Thread starter PS
  • Start date Start date
P

PS

Hi,

In Excel VBA, I can read Excel add-in member name through this code ...

--------------
Dim e As Excel.AddIn
For Each e In Application.AddIns
Debug.Print e.Name
Next
--------------

But in VB.Net, It results in Error.

--------------
Imports Excel = Microsoft.Office.Interop.Excel

Module Module1
Sub Main()
Dim xl As New Excel.Application
xl.Workbooks.Add()
xl.Visible = True
Dim e As Excel.AddIn
For Each e In xl.AddIns ' <<---Error
Console.WriteLine(e.Name)
Next
Console.ReadLine()
End Sub
End Module
 
hmmm. this is interesting to me. I want to know the answer also.
One note. Since e is the variable name for one of the 2 param passed to
every event in vb I would refrain from using it for any other purpose.

Also, what is the error that might help us...??

Shane
 
Back
Top