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
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