Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
运行时错误“91”:对象变量或未设置块
我的代码是
Private Sub Workbook_Open() Dim MenuBar As CommandBarButton Set MenuBar = CommandBars(Standard).Controls(3) MsgBox MenuBar.Caption End Sub
请帮我解决这个错误。
你把Standard而不是"Standard". 因此我总是建议使用Option Explicit.
Standard
"Standard"
Option Explicit
如果不使用"thenStandard则被视为变量。
"