![]() |
Addin Issues
Anybody have any ideas?
|
Addin Issues
On Jan 15, 11:18 am, thedude wrote:
Anybody have any ideas? Guess not? |
Addin Issues
Well - i figured out issue 4. It appears that when you use the
'MenuItems' tags, it is a temporary solution. To fix it, i replaced the 'Private Function AddMenus()' and 'PrivateFunction AddMenuItems()' with the code below. However, i'm still having trouble getting the code to delete itself after running through it as well as getting the Add-In to replace any existing Add-Ins. Any advice would be appreciated. Thanks, Thedude Function Add_Menus() '''''''''''''''''''''''''''''''''''''''''''''''''' ''' ' Finds the index of the Help Menu. ' '''''''''''''''''''''''''''''''''''''''''''''''''' ''' HelpMenu = Application.CommandBars("Worksheet Menu Bar") _ ..Controls("Help").Index '''''''''''''''''''''''''''''''''''''''''''''''''' ''' ' Sets up and enters the two Menus ' '''''''''''''''''''''''''''''''''''''''''''''''''' ''' Set cbmainmenubar = _ Application.CommandBars("Worksheet Menu Bar") Set cbMPE_Analysis = _ cbmainmenubar.Controls.Add(Type:=msoControlPopup, _ befo=HelpMenu) With cbMPE_Analysis .Caption = "&Menu1" End With Set cbMPE_KServer = _ cbmainmenubar.Controls.Add(Type:=msoControlPopup, _ befo=HelpMenu + 1) With cbMPE_KServer .Caption = "&Menu2" End With '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''' Setting up the analysis menu ' ' 1 - Menu Item 1 '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' Set cbAnalysis_MenuItem1 = cbMPE_Analysis.Controls.Add _ (Type:=msoControlPopup) With cbAnalysis_MenuItem1 .onaction = "......" .Caption = "&MenuItem1" End With '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' ' Setting up the analysis menu ' ' 1 - Menu Item 1 ' 2 - Menu Item 2 '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' Set cbAnalysis_MenuItem2 = cbMPE_Analysis.Controls.Add _ (Type:=msoControlPopup) With cbAnalysis_MenuItem2 .Caption = "&MenuItem2" .onaction = "......" '.TooltipText = "" End With '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' ' Setting up the analysis menu ' ' 1 - Menu Item 1 ' 2 - Menu Item 2 ' 3 - Menu Item 3 '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' Set cbAnalysis_MenuItem3 = cbMPE_Analysis.Controls.Add _ (Type:=msoControlPopup) With cbAnalysis_MenuItem3 .Caption = "&MenuItem3" .onaction = "......" '.TooltipText = "" End With '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' ' Setting up the analysis menu ' ' 1 - Menu Item 1 ' 2 - Menu Item 2 ' 3 - Menu Item 3 ' 4 - Menu Item 4 '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' Set cbAnalysis_MenuItem4= cbMPE_Analysis.Controls.Add _ (Type:=msoControlPopup) With cbAnalysis_MenuItem4 .Caption = "M&MenuItem4" .onaction = "......" End With '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' ' Setting up the analysis menu ' ' 1 - Menu Item 1 ' 2 - Menu Item 2 ' 3 - Menu Item 3 ' 4 - Menu Item 4 ' 5 - Menu Item 5 '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''' Set cbAnalysis_MenuItem5 = cbMPE_Analysis.Controls.Add _ (Type:=msoControlButton) With cbAnalysis_MenuItem5 .Caption = "MenuItem5l" .onaction = "......" End With ''''''''''''''''''''''''''''''''''''''''''''' ' First is the SubMenuItem ' ''''''''''''''''''''''''''''''''''''''''''''' With cbAnalysis_SubMenuItem1a.Controls.Add _ (Type:=msoControlButton, befo=1) .onaction = "......." End With With cbAnalysis_SubMenuItem1b.Controls.Add _ (Type:=msoControlButton, befo=2) .onaction = "......." End With ''''''''''''''''''''''''''''''''''''''''''''''''' ' Second is the SubMenuItem2' ''''''''''''''''''''''''''''''''''''''''''''''''' With cbAnalysis_SubMenuItem2a.Controls.Add _ (Type:=msoControlButton, befo=1) .onaction = "......."" End With ''''''''''''''''''''''''''''''''''''''''''''''''' ' Third is the SubMenuItem3 ''''''''''''''''''''''''''''''''''''''''''''''''' With cbAnalysis_SubMenuItem3.Controls.Add _ (Type:=msoControlButton, befo=1) .onaction = "......." End With ''''''''''''''''''''''''''''''''''''''''''''''''' ' Fourth is the SubMenuItem4 ''''''''''''''''''''''''''''''''''''''''''''''''' With cbAnalysis_SubMenuItema.Controls.Add _ (Type:=msoControlButton, befo=1) .onaction = "......." End With With cbAnalysis_SubMenuItemb.Controls.Add _ (Type:=msoControlButton, befo=2) .onaction = "......." End With With cbAnalysis_SubMenuItemc.Controls.Add _ (Type:=msoControlButton, befo=3) .onaction = "......." End With |
Addin Issues
Okay. I've got 1, 2, 2a, 2b, 4, and 5 working. The code below did
the trick as far as deleting the install module, and i think i'm close to figuring out why they addin won't remain checked after installation. If anybody would like to chime in, though, please feel free to join this very stimulating conversation we've got going on. I think the problem before was that i had Dimensioned X as an object as opposed to a VBComponent. Sub SaveAndDelete() Dim x As VBComponent With ThisWorkbook AddinTitle = Left(.Name, Len(.Name) - 4) AddinName = AddinTitle & ".xla" Application.DisplayAlerts = False a = Application.UserLibraryPath & AddinName .SaveAs Application.UserLibraryPath & AddinName Application.DisplayAlerts = True End With For Each x In ThisWorkbook.VBProject.VBComponents If x.Name = "Update_MP_Toolkit" Then ThisWorkbook.VBProject.VBComponents.Remove x End If Next x End End Sub |
All times are GMT +1. The time now is 01:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com