PC Review


Reply
Thread Tools Rate Thread

Add-in doesn't load properly

 
 
Phil Hibbs
Guest
Posts: n/a
 
      12th May 2010
If I start Excel up from the Start Menu, everything is fine. My add-
ins work with no complaints. If I start Excel by opening a
spreadsheet, though, the add-ins don't load until I invoke their menu
item, and then I get a macro security message box. Am I doing
something wrong, or is this normal behaviour?

Phil Hibbs.
 
Reply With Quote
 
 
 
 
GS
Guest
Posts: n/a
 
      13th May 2010
Phil Hibbs presented the following explanation :
> If I start Excel up from the Start Menu, everything is fine. My add-
> ins work with no complaints. If I start Excel by opening a
> spreadsheet, though, the add-ins don't load until I invoke their menu
> item, and then I get a macro security message box. Am I doing
> something wrong, or is this normal behaviour?
>
> Phil Hibbs.


Sounds to me like your addin is using an 'attached' custom
menus/toolbar that you built via the Excel the UI, and if so then ditch
it and go with the suggestions that follow.

If your addin may also be creating 'Permanent' menus that persist in
the UI, whether the addin is loaded or not. The fact that it doesn't
load until you click one of its menus suggests the addin has not been
properly 'installed' via Addins Manager. Is it really an addin (.xla)
or just a workbook (.xls) with macros?

If Addin creating its own menus:
First thing I suggest is to set the IsTemporary property to TRUE, and
add code to delete the menus on shutdown. Compliment that by ensuring
your addin creates new menus on startup only AFTER it deletes them in
that same procedure. This will prevent duplication if the menus already
exist in cases, for example, restart after Excel crashes (if
AutoRecovery is enabled).

It's good programming practice to ensure that whatever changes to Excel
are made by your project (at startup or during runtime) that these get
undone at shutdown.

HTH
Garry


 
Reply With Quote
 
Phil Hibbs
Guest
Posts: n/a
 
      13th May 2010
The problem appears to have gone away today. Maybe Excel had crashed
earlier in the day and was just a bit messed up.

> If Addin creating its own menus:
> First thing I suggest is to set the IsTemporary property to TRUE, and


Is that a property of the menu item?

> add code to delete the menus on shutdown. Compliment that by ensuring
> your addin creates new menus on startup only AFTER it deletes them in
> that same procedure. This will prevent duplication if the menus already
> exist in cases, for example, restart after Excel crashes (if
> AutoRecovery is enabled).


I actually started doing that consistently a couple of days ago after
I started getting duplicates!

Sub add_menu()
Call remove_menu
CommandBars("Worksheet Menu Bar") _
.Controls(MENU_NAME) _
.Controls.Add(Type:=msoControlButton) _
.Caption = MENU_ITEM
CommandBars("Worksheet Menu Bar") _
.Controls(MENU_NAME) _
.Controls(MENU_ITEM) _
.OnAction = FUNCTION_NAME
End Sub

Sub remove_menu()
Dim ctl As CommandBarControl
For Each ctl In CommandBars("Worksheet menu
bar").Controls(MENU_NAME).Controls
If ctl.Caption = MENU_ITEM Then
ctl.Delete
End If
Next ctl
End Sub

Phil Hibbs.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro doesn't properly record AutoSum (and SendKeys doesn't work) =?Utf-8?B?Y3JpbXNvbmtuZw==?= Microsoft Excel Programming 2 21st Nov 2006 02:11 PM
Windows XP Doesn't Properly Load - Denied Access to CPU! =?Utf-8?B?Sm9lS3JhdHo=?= Windows XP Help 0 26th Mar 2006 11:54 PM
Excel Doesn't Load Properly pjs Microsoft Excel Misc 2 30th Sep 2004 11:31 PM
Windows Update Doesn't Load Properly James Johnson Windows XP General 3 27th Aug 2004 04:12 AM
Idle-timed Hibernate and/or standby sometimes works and sometimes doesn't, why doesn't it work properly all the time???????? harry Windows XP Performance 0 15th Jan 2004 08:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:37 PM.