Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Add-in doesn't load properly

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Add-in doesn't load properly

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Add-in doesn't load properly

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
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
Best way to format a flat file that Excel will load properly? ker_01 Excel Programming 8 January 13th 10 01:44 AM
How to load web page into Excel properly? Eric Excel Discussion (Misc queries) 2 August 16th 09 04:55 PM
=sum doesn't work properly Jewels Excel Programming 2 May 9th 08 07:17 PM
F2 key is not functioning properly [email protected] Excel Discussion (Misc queries) 4 May 9th 07 06:12 PM
Does not add up properly PCOR Excel Discussion (Misc queries) 3 March 8th 05 07:55 PM


All times are GMT +1. The time now is 10:19 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"