在VBA中迭代对象浏览器 [英] Iterating through the Object Browser in VBA
本文介绍了在VBA中迭代对象浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想迭代通过引用库中任何类的成员,很像使用对象浏览器。
I would like to iterate through members of any class in a referenced library much like is done using the Object Browser. How can this be done using VBA?
推荐答案
我发现了一个来自Microsoft的KB ,这允许我这样做。
I found a KB from Microsoft which allowed me to do just that. It also covers iteration over Member details as well.
Private Sub ListClassesInAccess()
Dim TypeLibrary As TypeLibInfo
Dim ClassList As CoClasses
Dim i As Integer
Dim Path As String
Path = "C:\Program Files\Microsoft Office\OFFICE11\MSACC.OLB"
Set TypeLibrary = TypeLibInfoFromFile(Path)
Set ClassList = TypeLibrary.CoClasses
For i = 1 To ClassList.Count
MsgBox ClassList.Item(i).Name
Next
Set TypeLibrary = Nothing
Set ClassList = Nothing
End Sub
这篇关于在VBA中迭代对象浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文