Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-09-2009, 03:44 AM
cookieboy66's Avatar
cookieboy66 cookieboy66 is offline Custom menu keeps reverting back to old code Windows XP Custom menu keeps reverting back to old code Office 2003
Novice
Custom menu keeps reverting back to old code
 
Join Date: Aug 2009
Location: Auckland, New Zealand
Posts: 1
cookieboy66 is on a distinguished road
Default Custom menu keeps reverting back to old code

I've written some code to add a custom menu to MS Word with a whole lot of frequently used templates. This was working fine but some of the templates were updated and the filenames changed. So I updated the code that adds the menu (and added some additional templates), only now when I open Word the old menu is there. The code for the menu was taken from another website and adapted to suit. Can anyone help me change the code so that the menu stays consistent.



I've saved the file with the code as a template and put it in the start up folder so it runs as an add in.

The code is:

Code:
Sub AddMenuBar() 
 
Dim Mybar As CommandBar 
Dim cmd As CommandBarPopup 
Dim i As Integer 
Dim A(35) As Variant 
Dim myButton 
CustomizationContext = Application.NormalTemplate 
' CustomizationContext = ActiveDocument.AttachedTemplate
On Error Resume Next 
CommandBars("Menu Bar").Controls("C&ooke").Delete 
'Note that the parts of the array are ("Title of menu option","Macro to Run", FaceID for toolbar button)
A(1) = Array("Print to PDF", "PDF", 4) 
A(2) = Array("Insert Header/Footer", "Header_footer", 237) 
A(3) = Array("Works Instruction", "Works_Instruction", 102) 
A(4) = Array("Insert Signature", "Insert_Signature", 593) 
A(5) = Array("Company Memo", "CompanyMemo", 5765) 
A(6) = Array("Report", "Report", 2042) 
A(7) = Array("Mechanical Services Maintenance Proposal", "Mech_Serv_Maint_Proposal", 548) 
A(8) = Array("Acoustic door quote", "Acoustic_door_quote", 0) 
A(9) = Array("Aerco quote", "Aerco_quote", 0) 
A(10) = Array("AHU quote", "AHU_quote", 0) 
A(11) = Array("Boiler quote - Ambassador", "Ambassador_Boiler_quote", 0) 
A(12) = Array("Boiler quote - ICI Caldaie", "ICI_Boiler_quote", 0) 
A(13) = Array("Boiler quote - Unical ", "Unical_Boiler_quote", 0) 
A(14) = Array("Calorifier quote - Britannia", "Britannia_Calorifier_Quote", 0) 
A(15) = Array("Calorifier quote", "Calorifier_Quote", 0) 
A(16) = Array("Clivet chiller quote", "Clivet_chiller_quote", 0) 
A(17) = Array("Coil quote", "Coil_quote", 0) 
A(18) = Array("Cooling tower quote", "Cooling_Tower_quote", 0) 
A(19) = Array("Damper/louvre quote", "Damper_louvre_quote", 0) 
A(20) = Array("Diffuser quote", "Diffuser_quote", 0) 
A(21) = Array("Dry cooler quote", "Dry_cooler_quote", 0) 
A(22) = Array("Duct quote", "Duct_quote", 0) 
A(23) = Array("Expansion tank quote", "Expansion_tank_quote", 0) 
A(24) = Array("Fan quote", "Fan_quote", 0) 
A(25) = Array("FCU quote", "FCU_quote", 0) 
A(26) = Array("Flue quote", "Flue_quote", 0) 
A(27) = Array("Gas fired heater quote", "Gas_fired_heater_quote", 0) 
A(28) = Array("Humidifier quote", "Humidifier_quote", 0) 
A(29) = Array("Plate heat exchanger quote", "Plate_heat_exch_quote", 0) 
A(30) = Array("Pump quote", "Pump_quote", 0) 
A(31) = Array("Recuperator quote", "Recuperator_quote", 0) 
A(32) = Array("Refrigeration vessel quote", "Refrigeration_vessel_quote", 0) 
A(33) = Array("Silencer quote", "Silencer_quote", 0) 
A(34) = Array("Tank quote", "Tank_quote", 0) 
A(35) = Array("VAV quote", "VAV_quote", 0) 
With CommandBars("Menu Bar").Controls 
.Add(Type:=msoControlPopup, Before:=9).Caption = "C&ooke" 
End With 
For i = 1 To UBound(A) 
With CommandBars("Menu Bar").Controls("C&ooke").Controls 
Set myButton = .Add(Type:=msoControlButton) 
With myButton 
.Caption = A(i)(0) 
.OnAction = A(i)(1) 
.FaceId = A(i)(2) 
End With 
End With 
Next i 
End Sub 
 
Private Sub Acoustic_door_quote() 
'
' Starts a new Acoustic door quote document
Application.ScreenUpdating = False 
Documents.Add Template:="P:\Templates\WkTempl\Quote_Acoustic_door.dot" 
Application.ScreenUpdating = True 
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom menu keeps reverting back to old code in 2007, going BACK on a hyperlink Butch Jackman Word 9 02-02-2011 11:29 PM
Custom menu keeps reverting back to old code How to Jump Back and Forth? jjudson PowerPoint 1 08-02-2009 12:04 AM
Menu Bar locked jaybea Word 4 05-18-2009 11:05 AM
Missing Command Menu lmd02814 Word 0 04-06-2009 11:28 AM
Opening messages/Code/custom archive jdd2 Outlook 0 12-20-2005 08:55 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 12:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft