View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default I want to cylce through all the open .xla's as well as the .xls'

Sub test()
Dim adn As AddIn
Dim vbp As Object ' VBProject
Dim vbComp As Object ' VBComponent
Dim sName As String

For Each adn In Application.AddIns
If adn.Installed Then
sName = adn.Name
On Error Resume Next
Set vbp = Workbooks(adn.Name).VBProject
On Error GoTo 0
If vbp Is Nothing Then
Debug.Print sName & " project n/a" ' eg ANALYS32.XLL
ElseIf vbp.Protection = 1 Then 'vbext_pp_locked
Debug.Print sName & " locked"
Else ' vbext_pp_none
Debug.Print sName
For Each vbComp In vbp.VBComponents
Debug.Print , vbComp.Name
Next
End If
End If
Next
End Sub

Regards,
Peter T
"pinkfloydfan" wrote in message
ups.com...
Actually, that still leaves me with a problem

I want to be able to cycle through the VBComponents in each addin. If
I was looking at a Workbook then I would use:

For Each mybook In Application.Workbooks
For Each vbcomp In mybook.VBProject.VBComponents


But I can't see a way to access the VBProject property from the Addins
collection

Any ideas?

Thanks a lot
Lloyd