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: 15
Default Commandbars dynamic menu creation problem

Hi-
Problem have a large workbook/macro that the user needs to open occasionaly.
I am trying to create a small sized workbook (ACT-Menu.xls) to open every
time Excel starts, add one menu Item to an existing menu and poit to a local
macro. This macro merely opens the worksheet and starts an Auto_Open
subroutine in the newly opened macro. I have ACT-Menu.xls protected, hidden
and stored in the XLStart Folder. On opening Excel it gives an error on the
following line -
Set cbcNext = Application.CommandBars(1).Controls("ACT!").Contro ls.Add
Macro code below
If I open the macro in the VB Editor, I can step thru it without error.
What's the problem??

Option Explicit
Private Sub Workbook_Open()
Dim cbcNext As CommandBarControl
Dim strErr As String
Dim intL As Integer
On Error Resume Next
Application.CommandBars(1).Controls("ACT!").Contro ls("Next Report").Delete
On Error GoTo ErrorHandler
intL = 1
Set cbcNext = Application.CommandBars(1).Controls("ACT!").Contro ls.Add
intL = 2
cbcNext.Caption = "&Next Report"
intL = 3
cbcNext.OnAction = "OpenACTReports"
intL = 4
cbcNext.BeginGroup = True
intL = 5
Workbooks.Add
Exit Sub
ErrorHandler:
strErr = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description & Chr(13) & _
"for line # " & Str(intL)
MsgBox strErr, , "Error", Err.HelpFile, Err.HelpContext
End Sub

Thanks in advance,
--
Gus Evans
 
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
Dynamic Formula Creation?? [email protected] Excel Discussion (Misc queries) 2 October 27th 06 09:14 AM
ASP Dynamic Excel Creation Chris Oswald Excel Programming 0 November 9th 04 05:27 PM
Menu creation - from DLL rather than .XLA R Avery Excel Programming 2 April 6th 04 07:26 PM
Dynamic Control Creation in VBA Asif[_3_] Excel Programming 2 December 9th 03 07:35 PM
Dynamic Creation of borders Tyrusst Excel Programming 1 October 15th 03 12:47 PM


All times are GMT +1. The time now is 07:14 PM.

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"