Run Time Error '91' : Object Variable or With Block not Set
My code is
Private Sub Workbook_Open()
Dim MenuBar As CommandBarButton
Set MenuBar = CommandBars(Standard).Controls(3)
MsgBox MenuBar.Caption
End Sub
Please help me to resolve this error.
You have put Standard
instead of "Standard"
. And hence I always suggest to use Option Explicit
.
If you don't use the "
then Standard
is treated as a variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.