View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
d_rodman d_rodman is offline
external usenet poster
 
Posts: 1
Default VBA-Make Custom Menu Item Fire

Hello,
I am trying to make my userform "frmSearch" able to be fired up fro
the regular menu. It is loaded right away, but the user needs to b
able to close it and reopen whenever they need it. My code creates th
Menu item, but when I click on it, it does nothing. I have inserted m
code below. I need help by the "TODO: show search agentThanks i
advance, I appreciate any help.

In "This Workbook:"
Private Sub Workbook_Open()
frmSearch.Show

Dim con

For Each con In Application.CommandBars(1).Controls
If con.Caption = "Agent" Then
con.Delete
End If
Next

With Application.CommandBars(1).Controls.Add(msoControl Popup)
.Caption = "Agent"
.OnAction = "Show_frmSearch" 'TODO: show search agent
End With

In a module:
Public Sub Show_frmSearch()
frmSearch.Show
End Su

--
Message posted from http://www.ExcelForum.com