zelarra821
Registered User.
- Local time
 - Today, 14:09
 
- Joined
 - Jan 14, 2019
 
- Messages
 - 860
 
I have a function in a module to create a context menu, but when I run it I get the error "5 Invalid Argument or Procedure Call", and I don't know where the error is.
This is the code:
	
	
	
		
I don't know if that error can be solved, or it will be necessary to do an on error resume next to avoid the problem.
Thanks!
 This is the code:
		Code:
	
	
	Public Function MenuContextual()
On Error GoTo err_lbl
Dim myBar As CommandBar
CommandBars("ShortcutMenu").Delete
Set myBar = CommandBars _
    .Add(Name:="ShortcutMenu", Position:=msoBarPopup, Temporary:=False)
With myBar
    .Controls.Add Type:=msoControlButton, ID:=19
    .Controls.Add Type:=msoControlButton, ID:=22
End With
myBar.ShowPopup
Salida:
    Exit Function
err_lbl:
    MsgBox "MenuContextual: " & Err.Number & " " & Err.Description, vbInformation, NombreBD
    Resume Salida
End Function
	I don't know if that error can be solved, or it will be necessary to do an on error resume next to avoid the problem.
Thanks!