Table of contents
TOC
折叠目录
展开目录

AllMacros 对象 (访问)AllMacros Object (Access)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

AllMacros集合包含当前项目CodeProject对象中的每个宏AccessObjectThe AllMacros collection contains an AccessObject for each macro in the CurrentProject or CodeProject object.

注解Remarks

当前项目CodeProject对象具有AllMacros集合,该集合包含描述指定的当前项目CodeProject的所有宏的实例的AccessObject对象。例如,您可以枚举AllMacros集合在 Visual Basic 来设置或返回该集合中的单个AccessObject对象的属性的值。The CurrentProject or CodeProject object has an AllMacros collection containing AccessObject objects that describe instances of all the macros specified by CurrentProject or CodeProject. For example, you can enumerate the AllMacros collection in Visual Basic to set or return the values of properties of individual AccessObject objects in the collection.

您可以通过引用对象名称,或在集合中的索引引用AllMacros集合中的单个AccessObject对象引用。如果要引用AllMacros集合中特定的对象,则最好宏名称引用,因为宏的集合索引可能会更改。You can refer to an individual AccessObject object in the AllMacros collection either by referring to the object by name, or by referring to its index within the collection. If you want to refer to a specific object in the AllMacros collection, it's better to refer to the macro by name because a macro's collection index may change.

AllMacros集合进行索引从零开始的索引。如果要引用宏通过其索引,第一个宏 AllMacros(0),第二个宏为 AllMacros(1),依此类推。The AllMacros collection is indexed beginning with zero. If you refer to a macro by its index, the first macro is AllMacros(0), the second macro is AllMacros(1), and so on.

请注意 若要列出数据库中所有打开的宏,请使用IsLoaded每个AccessObject对象AllMacros集合中。然后可以使用每个AccessObject对象的Name属性返回一个宏的名称。Note To list all open macros in the database, use the IsLoaded property of each AccessObject object in the AllMacros collection. You can then use the Name property of each individual AccessObject object to return the name of a macro.

您不能添加或从AllMacros集合中删除一个AccessObject对象。You can't add or delete an AccessObject object from the AllMacros collection.

示例Example

下面的示例打印AllMacros集合中每个打开的AccessObject对象的名称。The following example prints the name of each open AccessObject object in the AllMacros collection.

Sub AllMacros() 
 Dim obj As AccessObject, dbs As Object 
 Set dbs = Application.CurrentProject 
 ' Search for open AccessObject objects in AllMacros collection. 
 For Each obj In dbs.AllMacros 
 If obj.IsLoaded = True Then 
 ' Print name of obj. 
 Debug.Print obj.Name 
 End If 
 Next obj 
End Sub

属性Properties

名称Name
ApplicationApplication
CountCount
ItemItem
ParentParent

另请参阅See also

其他资源Other resources

Access 对象模型引用Access Object Model Reference

© 2018 Microsoft