stop app from running on workbook open

d0wnt0wn

Well-known Member
Joined
Oct 28, 2002
Messages
771
hi i was wondering if someone could look at this code for me and tell me how to stop the calculator app from running on open...



Private Sub Workbook_Open()
Dim Ctl As CommandBarControl
Dim MenuItem As CommandBarControl
On Error Resume Next
Set Ctl = Application.CommandBars(1).FindControl(ID:=30007)
If Ctl Is Nothing Then
MsgBox "Cannot add a menu item to the Tools menu.", vbCritical, APPNAME
Else
Ctl.Controls(APPNAME).Delete
On Error GoTo 0
Set MenuItem = Ctl.Controls.Add
With MenuItem
.caption = APPNAME
.OnAction = "ShowCalculatorToolbar"
End With
End If
On Error GoTo 0
ShowCalculatorToolbar
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Ctl As CommandBarControl
Dim MenuItem As CommandBarControl
On Error Resume Next
Set Ctl = Application.CommandBars(1).FindControl(ID:=30007)
Ctl.Controls(APPNAME).Delete
On Error GoTo 0
End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,222,095
Messages
6,163,900
Members
451,865
Latest member
dunworthc

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top