LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autoload custom menu on Workbook Open

Hi!

I am trying to add a custom item to the menu bar in Excel
when a specific workbook opens, with code as listed
below. The code runs without problems if I execute it
after the workbook has been opened, but I get an error
message if I paste and run the code in the Workbook_Open
procedure. Error message is typical Error 438 or Object
variable not set. I have tried to declare the variable at
a few different places with no luck. Any suggestions?

Johann

Code extract ************

Sub Macro2()

Dim VWSMenu As Object
Dim VWSSub1 As Object
Dim VWSSub2 As Object

Set VWSMenu = CommandBars("Worksheet Menu Bar").Controls.
Add(Type:=msoControlPopup, Befo=11, Temporary:=True)
With VWSMenu
.Caption = "VWS &Menu"
End With

Set VWSSub1 = CommandBars("Worksheet Menu Bar").Controls
("VWS Menu")
With VWSSub1
.Controls.Add(Type:=msoControlPopup,
Befo=1).Caption = "Leads List"
End With


etc.**************
 
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
Custom Menu Help EAB1977 Excel Worksheet Functions 1 November 12th 05 01:02 AM
Creating Menu to open workbook kwatch Excel Worksheet Functions 1 April 14th 05 06:54 PM
Custom Menu Luis Excel Programming 1 December 12th 03 01:54 PM
Custom Menu ewize1 Excel Programming 2 October 30th 03 05:16 PM


All times are GMT +1. The time now is 04:42 AM.

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

About Us

"It's about Microsoft Excel"