The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Requested Member of the Collection Does Not Exist
Word Developer Reference
The "requested member of the collection does not exist" error occurs when you try to access an object that does not exist. For example, the following instruction may post an error if the active document does not contain at least one table.
To avoid this error when accessing a member of a collection, ensure that the member exists prior to accessing the collection member. If you are accessing the member by index number, you can use the Count
property of the collection to determine if the member exists. The following example selects the first table, if there is at least one table in the active document.
If ActiveDocument.Tables.Count > 0 Then
MsgBox "Document doesn't contain a table"
If you are accessing a collection member by name, you can loop on the elements in a collection using a For Each...Next loop to determine if the named member is part of the collection. For example, the following deletes the AutoCorrect entry named "acheive" if it is part of the AutoCorrectEntries
collection. For more information, see Looping Through a Collection.
Dim aceEntry As AutoCorrectEntry
For Each aceEntry In AutoCorrect.Entries
If aceEntry.Name = "acheive" Then aceEntry.Delete
Was this page helpful?
Your feedback about this content is important. Let us know what you think.