Use an enumerator to traverse the contents of a .NET collection.
IEnumerator myEnum CommandBar myCommandBar myApplication = Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.9.0",""); myCommandBars = myApplication.CommandBars ; myEnum = myCommandBars.GetEnumerator(); do while myEnum.MoveNext() myCommandBar = myEnum.Current MessageBox ( "CommandBar", myCommandBar.Name ) loop