G
Gordon
Hi,
If I run the line below in the immediates window it works.
CommandBars("standard").Controls.Item(5).Delete
It deletes the fifth control on my toolbar.
Yet it gives me an error when its run on the Before close
event where I need it for my Excel add-in.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
CommandBars("standard").Controls.Item(5).Delete
End Sub
This gives me an error and I can't figure out why.
This is the error:
Runtime error 91 Object variable or With Block variable
not set
If I make this an Auto_Close macro this line of code
works. something about the before close event of the
workbook makes it not work!
Any Ideas?
Thanks in advance
Gordon
If I run the line below in the immediates window it works.
CommandBars("standard").Controls.Item(5).Delete
It deletes the fifth control on my toolbar.
Yet it gives me an error when its run on the Before close
event where I need it for my Excel add-in.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
CommandBars("standard").Controls.Item(5).Delete
End Sub
This gives me an error and I can't figure out why.
This is the error:
Runtime error 91 Object variable or With Block variable
not set
If I make this an Auto_Close macro this line of code
works. something about the before close event of the
workbook makes it not work!
Any Ideas?
Thanks in advance
Gordon