Wie weet er wat er fout gaat bij de volgende code om een menu knop in de menu balk te verkrijgen waarmee ik dan een userform oproep. ik krijg da de volgende foutmelding " de typen komen niet met elkaar overeen"
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Save
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar") _
.Controls("Print Report").Delete
End Sub
Private Sub Workbook_Open()
Dim myButton As CommandButton
Set myButton = _
Application.CommandBars("Worksheet Menu Bar").Controls.Add
myButton.Caption = "&Print Report"
myButton.Style = msoButtonCaption
myButton.BeginGroup = True
myButton.OnAction = "ShowForm"
End Sub[/SIZE]
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Save
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar") _
.Controls("Print Report").Delete
End Sub
Private Sub Workbook_Open()
Dim myButton As CommandButton
Set myButton = _
Application.CommandBars("Worksheet Menu Bar").Controls.Add
myButton.Caption = "&Print Report"
myButton.Style = msoButtonCaption
myButton.BeginGroup = True
myButton.OnAction = "ShowForm"
End Sub[/SIZE]