Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Menu problem

Hi All,

The code snippet below is supposed to put a custom menu on the Excel
menu bar. I have used it many times before without a problem. I have
other files with the same coding that open in my current version of
Excel 2003 which open and insert the menu without a problem.

In this particular workbook it throws up the following error

'User defined type not defined'

and greys out 'CommandBarControl' but surely this is defined using the
Set statement?

What can cause this in this specific workbook and not others?

There is code within this workbook that gets data from Outlook but
apart from that l dont beleieve there is anything special about it.

I have checked the references and everything appears to be OK.

Private Sub Workbook_Open()

Call DeleteMenu

Dim michaelsmenu As CommandBarControl
Set michaelsmenu = Application.CommandBars("Worksheet Menu
Bar").Controls.Add(Type:=msoControlPopup, Befo=8)
michaelsmenu.Caption = "&CARTEK"
michaelsmenu.BeginGroup = False
michaelsmenu.Visible = True

Dim mymenu1 As CommandBarControl
Set mymenu1 = michaelsmenu.Controls.Add(Type:=msoControlButton)
mymenu1.Visible = True
mymenu1.Style = msoButtonCaption
mymenu1.Caption = "Get unsubscribers and remove"
mymenu1.OnAction = "ListUnsubscribers"

Dim mymenu2 As CommandBarControl
Set mymenu2 = michaelsmenu.Controls.Add(Type:=msoControlButton)
mymenu2.Visible = True
mymenu2.Style = msoButtonCaption
mymenu2.Caption = "Remove specific email address"
mymenu2.OnAction = "emailremove"

All help gratefully received

Regards

Michael Beckinsale

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Menu problem


This is part of a menu generator I use.

Dim cbmMainMenu As CommandBarPopup
Dim cbmSubMenu As CommandBarPopup
Dim cbmSecondSubMenu As CommandBarControl

On Error GoTo HandleErr

With Application.CommandBars(1).Controls

Set cbmMainMenu = .Add(Type:=msoControlPopup, Temporary:=True)

With cbmMainMenu
.Caption = "&" & cstrMENU
.Tag = cstrMENU

Set cbmSecondSubMenu
cbmMainMenu.Controls.Add(msoControlButton)

With cbmSecondSubMenu
.Caption = "&Prepare Barra Upload"
.OnAction = "Prepare"
End With

Set cbmSecondSubMenu
cbmMainMenu.Controls.Add(msoControlButton)

With cbmSecondSubMenu
.Caption = "&Generate Excel Report"
.OnAction = "GenReport"
End With

Set cbmSecondSubMenu
cbmMainMenu.Controls.Add(msoControlButton)

With cbmSecondSubMenu
.Caption = "&Set File Paths"
.OnAction = "SetFilePaths"
.BeginGroup = True
End With

End With

End With

ExitHe
Exit Sub

HandleErr

--
MattShoreso
-----------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...nfo&userid=347
View this thread: http://www.excelforum.com/showthread.php?threadid=56655

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PRoblem with Menu Set up ExcelMonkey Excel Programming 4 October 4th 05 10:30 PM
MENU Problem tony moody Excel Programming 0 September 18th 04 05:32 PM
MENU Problem TAM Excel Programming 0 September 18th 04 03:00 PM
Menu problem [email protected] Excel Programming 0 October 23rd 03 01:53 AM


All times are GMT +1. The time now is 09:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"