I am trying to automate an item on the commandbar "cells" in Microsoft Excel.
I am adding a new item to the menu, and I have some VB code I want it to run when the item is clicked.
The problem is that in Excel, the OnAction property requires a Macro, not a VB sub/function.Code:If Not Application.Intersect(Target, Range("F13:F37")) Is Nothing Then Set ctlTemp = Application.CommandBars("cell").Controls.Add(Type:=msoControlButton, before:=1, temporary:=True) ctlTemp.Caption = "Search on Assembly #" ctlTemp.OnAction = "EnterPart" ctlTemp.Tag = "vlvwiz" End If
Does anyone know how I could make this Menu Item run my VB code?
Thanks!




Reply With Quote