ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add-In problem under new SOE (https://www.excelbanter.com/excel-programming/274182-re-add-problem-under-new-soe.html)

Gav !!

Add-In problem under new SOE
 
New Rule

Do not stick your subs in a module that is named the same as the sub - fixed, seems to work fine now. This all happened because I was trying to be Tidy. Oh Well Live and learn.

Thanks anyway guys.
"Gav !!" wrote in message ...
Folks

We have recently upgraded our SOE from NT4 to XP and all was well until I continued to work on an Excel App I had been writing and saving as an Add-In. The laptop I am writing this on last week was SOE5 ( NT4) Office 2000 now SOE6(XP)Office XP. Last week my drop down menu ( next to help ) ran fine and all subs worked ), this week when I updated the add-in with new code the subs I have written this week do not run but the old ones from the menu still do. The new ones give an error message something like XXX.xla!SubName cannot be found, and yet in the back end it is in the xla and if run from the backend it seems to work fine. Could someone please let me know if the code has changed toward the way a menu is created in XP, and what the new syntax if any would be.

here is a sample only of my menu structure, i think originally learnt from John W.

Option Explicit

Sub Auto_Open()



' Creates a new menu and adds menu items
Dim Cap(1 To 6)
Dim Mac(1 To 6)
Dim MenuName As String

MenuName = "&XXXXAnalysis"

Cap(1) = "Analyse The Data"
Mac(1) = "AnalyseData"
Cap(2) = "Adds the XXXX and XXXX"
Mac(2) = "addxxxx"
Cap(3) = "Puts in Sections"
Mac(3) = "addsections"
Cap(4) = "Prepares Dates for Runing Times"
Mac(4) = "Prepare_Dates"
Cap(5) = "Places Times into Sheet"
Mac(5) = "GetTimes"
Cap(6) = "Colour Legend"
Mac(6) = "Legend"


On Error Resume Next
' Delete the menu if it already exists
MenuBars(xlWorksheet).Menus(MenuName).Delete

' Add the menu
MenuBars(xlWorksheet).Menus.Add Caption:=MenuName, befo="Help"

' Add the menu items
With MenuBars(xlWorksheet).Menus(MenuName).MenuItems
.Add Caption:=Cap(1), OnAction:=Mac(1)
.Add Caption:="-"
.Add Caption:=Cap(2), OnAction:=Mac(2)
.Add Caption:=Cap(3), OnAction:=Mac(3)
.Add Caption:="-"
.Add Caption:=Cap(4), OnAction:=Mac(4)
.Add Caption:=Cap(5), OnAction:=Mac(5)
.Add Caption:="-"
.Add Caption:=Cap(6), OnAction:=Mac(6)

End With
End Sub

Sub Auto_Close()
Dim MenuName As String
MenuName = "&ATP Analysis"
' Delete the menu before closing
On Error Resume Next
MenuBars(xlWorksheet).Menus(MenuName).Delete
End Sub






All times are GMT +1. The time now is 04:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com