Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default I want to cylce through all the open .xla's as well as the .xls'

Hi there

If you use something like this:

For Each mybook In Application.Workbooks

It will only reference all the open .xls files. According to the help
you can use Application.Workbooks("filename.xla") to access a
single .xla if you know its name but that doesn't help to write
generic code.

Does anyone know of a way to cycle through all the open .xla's without
having to know their names first?

Thanks a lot
Lloyd

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default I want to cylce through all the open .xla's as well as the .xls'

Lloyd,
Use the AddIns collection ?
Check if each is .Installed, if so, do what you need.

NickHK

"pinkfloydfan" wrote in message
oups.com...
Hi there

If you use something like this:

For Each mybook In Application.Workbooks

It will only reference all the open .xls files. According to the help
you can use Application.Workbooks("filename.xla") to access a
single .xla if you know its name but that doesn't help to write
generic code.

Does anyone know of a way to cycle through all the open .xla's without
having to know their names first?

Thanks a lot
Lloyd



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default I want to cylce through all the open .xla's as well as the .xls'

Thanks Nick

That sounds good, just didn't know that it existed!

Cheers
Lloyd

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default I want to cylce through all the open .xla's as well as the .xls'

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default I want to cylce through all the open .xla's as well as the .xls'

Most addins that are not self written are password protected, so you would
not be able to access the components anyway.
Addins are not designed for this access in the Object model and AFAIK not
accessible., although I could well be wrong..

NickHK

"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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default I want to cylce through all the open .xla's as well as the .xls'

Thanks anyway Nick

Out of interest, after some searching I have found that MZTools will
generate XML documentation of procedures in both open .xla and .xls
files. This does what I was looking for.

http://www.mztools.com/v3/download.htm

All the best
Lloyd

  #7   Report Post  
Posted to microsoft.public.excel.programming
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




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

Also include -

' If adn.Installed Then
Set vbp = Nothing
' End if

at the beginning or end of the If...End If

Peter T

"Peter T" <peter_t@discussions wrote in message
...
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






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default I want to cylce through all the open .xla's as well as the .xls'

thanks everyone for your kind assistance

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you want to save the changes you made to 'ABC.xls'? Bob Barnes Excel Discussion (Misc queries) 4 March 9th 07 02:44 AM
Saving variables in XLA's Paul Excel Programming 2 July 9th 04 07:25 PM


All times are GMT +1. The time now is 11:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"