Outlook Does Not Recognize VBA Objects ??

  • Thread starter Thread starter MWE
  • Start date Start date
M

MWE

This is a really simple question ...

I have a very simple macro that lists the commandbars and
the value of the visible property.

Sub CmdBars_List()

Dim I As Long
Dim strBuffer As String

strBuffer = ""
For I = 1 To CommandBars.Count
strBuffer = strBuffer + CommandBars(I).Name + " "
+ _
Str(CommandBars(I).Visible) + Chr(10)
Next I
MsgBox strBuffer

End Sub


The macro runs fine in Excel or Word. It does not run in
Outlook. There is a compiler error stating that the
object CommandBars is undefined. Yet CommandBars is a
defined object in the Object Browser (all normal
references are checked in Tool / References).

Any thoughts?

Thanks
 
In Outlook, CommandBars is a child object of Explorer and Inspector: You
must specify which you want to use.
 
Back
Top