I had created the function below. It was working, but now, when you run it, it finds the cui and executes the RemovePartialMenu method, and the count decrements, but the cui doesn't actually get removed. The next time you run it, PartialCuiFiles.Count is back to what it was and the cui is still there. I'm on 2010. Friend Function UnloadPartialCui(ByVal PartialCuiPath As String) As Boolean
'CuiPath parameter is the fully qualified path of the partial cui to be removed from main cui.
Try
Dim strParentCui As String = Application.GetSystemVariable("MENUNAME") & ".cuix"
Dim oMainCui As CustomizationSection = New CustomizationSection(strParentCui)
For i = 0 To oMainCui.PartialCuiFiles.Count - 1
If oMainCui.PartialCuiFiles.Item(i).ToLower = PartialCuiPath.ToLower Then
oMainCui.RemovePartialMenu(PartialCuiPath)
End If
Next
Catch ex As Autodesk.AutoCAD.Runtime.Exception
Return False
Catch ex As System.IO.FileNotFoundException
Return False
Finally
UnloadPartialCui = True
End Try
End Function