Results 1 to 11 of 11

Workbook_BeforeClose Event - passing arguments

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-04-2004
    MS-Off Ver
    2013
    Posts
    148

    Workbook_BeforeClose Event - passing arguments

    Hi,

    I'm trying to use Workbook_BeforeClose event to delete my custom menus.

    However, when I try to pass the custom menu caption to the Sub, I get a compile error (Expected Function or Variable).

    I believe this has something to do with global variables declaration or something...

    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Run DeleteMenu(cbcCustomMenu.Caption)
    End Sub
    
    
    Sub DeleteMenu(menuName As String)
    
    Dim controlo
        For Each controlo In CommandBars("Worksheet Menu Bar").Controls
            If controlo.Caption = menuName Then controlo.Delete
        Next controlo
    'Application.CommandBars("Worksheet Menu Bar").Controls("Macros").Delete
    End Sub
    Thanks in advance!
    Last edited by pmguerra; 10-09-2008 at 09:32 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. combobox.exit event
    By fozze in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-03-2008, 07:27 AM
  2. Run-Time Error 91 When Dynamically Creating Controls and Event Handlers
    By chucklod in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-21-2008, 05:47 PM
  3. Arguments for Double Click event
    By dpenny in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2007, 06:49 PM
  4. Flagging event due dates
    By muskt in forum Excel General
    Replies: 7
    Last Post: 11-19-2006, 05:44 PM
  5. Passing arguments when opening Excel
    By david.fredrikss in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-13-2006, 08:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1