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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Maybe remove the last line in the Workbook_Open event procedure:

ShowCalculatorToolbar
 

Forum statistics

Threads
1,148,051
Messages
5,744,520
Members
423,881
Latest member
Nguyen Vu

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
Top