Hello all,
First off I don't understand why this particular client is still using vba to militantly control the user's seat of AutoCAD, but that's another story.
Here's the deal, this bit of code is from their latest release, the intent is to ensure that only (3) menu's are loaded into AutoCAD: acad.cuix (autocad), aecco.cuix (raster design), and paiaddin.cuix (client menu). The problem we have is it unloads a couple of menu's that we use that help us perform work for them like express tools.. In the past release I was able to modify this section to keep it from unloading newer versions of raster design and our menus, but this latest version does not seem to be working properly.
I'm burnt out on playing with it so maybe a fresh set of eyes can help me out here. Also to note is there was a transition between developers on maintaining this menu, so if there are any other suggestions as to other ways of unloading menu's please let me know.
Any help is much appreciated, Thanks!
Dustin
AutoCAD 2012, Raster Design 2012 on Windows 7 64-bit
Option Explicit Public Sub LoadPAIAddinMenu() LoadMenus ThisDrawing, ThisDrawing.FullName, True End Sub Public Function LoadMenus(acDocument As AcadDocument, FileName As String, bForce As Boolean) Dim acMenuGroup As AcadMenuGroup Dim acMenu As AcadMenuGroup Dim acPopUp As AcadPopupMenu Dim bAcadMenu As Boolean Dim bPaiMenu As Boolean For Each acMenuGroup In acDocument.Application.MenuGroups Debug.Print acMenuGroup.Name Select Case LCase(acMenuGroup.Name) Case "acad" bAcadMenu = True Case "paiaddin" bPaiMenu = True Case "usermenu" Case "aecco" Case "autocadrasterdesign" ' updated name for raster design menu for Autocad 2012 05-23-2013 J.Dillmn Case "XL2CAD" ' added to allow XL2CAD tables 11-25-2013 D.Campbell-Hutchinson Case "Express" ' added to allow express tools 11-25-2013 D.Campbell-Hutchinson Case "VR2013" ' added to allow SteelPLUS 11-25-2013 D.Campbell-Hutchinson Case Else acMenuGroup.Unload ' unload unknown menus End Select Next acMenuGroup If Not bAcadMenu Or Not bPaiMenu Or bForce Then On Error Resume Next For Each acMenuGroup In acDocument.Application.MenuGroups Debug.Print acMenuGroup.Name acMenuGroup.Unload Next acMenuGroup acDocument.Application.MenuGroups.Load "acad", True ' base menu With acDocument.Application .MenuGroups.Load "paiaddin", False ' partial menu With .MenuGroups("paiaddin").Menus .InsertMenuInMenuBar "&Layers", "&Window" .InsertMenuInMenuBar "&Insert Text", "&Window" .InsertMenuInMenuBar "&Edit Text", "&Window" .InsertMenuInMenuBar "&P&&ID", "&Window" .InsertMenuInMenuBar "P&lan", "&Window" .InsertMenuInMenuBar "&One Line", "&Window" .InsertMenuInMenuBar "&Schematic", "&Window" .InsertMenuInMenuBar "&Title Blocks", "&Window" .InsertMenuInMenuBar "CADDD &QC", "&Window" End With On Error Resume Next ' don't halt macro if aecco menu is not found .MenuGroups.Load "aecco", False ' partial cadoverlay menu With .MenuGroups("aecco").Menus ' CAD Overlay 2000i/2002 .InsertMenuInMenuBar "Im&age", "&P&&ID" End With With .MenuGroups("rasterdesign").Menus ' Raster Design 3, Raster Design 2005 .InsertMenuInMenuBar "Im&age", "&P&&ID" End With On Error Resume Next .MenuGroups.Load "xl2cad", False ' partial XL2CAD menu With .MenuGroups("xl2cad").Menus ' XL2CAD .InsertMenuInMenuBar "&XL2CAD", "&Window" End With On Error Resume Next .MenuGroups.Load "acetmain", False ' partial Express Tools menu With .MenuGroups("Express").Menus ' Express Tools .InsertMenuInMenuBar "E&xpress", "&Window" End With On Error Resume Next .MenuGroups.Load "STL2013x64", False ' partial SteelPLUS menu With .MenuGroups("VR2013").Menus ' SteelPlus Menu .InsertMenuInMenuBar "SteelPLUS", "&Window" End With On Error GoTo 0 End With End If End Function