The DTE object is the root object from which all other objects and collections in environment extensibility are accessed. Add-ins get the DTE object when the environment connects to the add-in in the OnConnection method. There is no other way to access the DTE object. If fact, as the DTE object is hidden, it is exposed to the VB add-in developer as the Visual Basic Extensibility object, and is referenced through the Visual Basic Integrated Development Environment object. The VBE object contains all extensibility objects and collections represented in Visual Basic for Applications, which in turn have properties, methods, and events which expose its functionality. To use the Visual Basic Extensibility object, your add-in project must reference the Microsoft Visual Basic 6.0 Extensibility library. You must also reference the Microsoft Add-In Designer as well as the Microsoft Office 8.0 Object Library. Quick Reference: Use the Windows collection to access the collection of windows. Includes Count, Parent, Item, CreateToolWindow, etc. A Window includes Caption, Move, Type, WindowState, Close, SetFocus, etc. Use the Addins collection to access the collection of add-ins. Includes Count, Parent, Item, Update. ConnectMode and RemoveMode. An Addin includes Connected, Description, Guid, ProgId, etc. Use the VBProjects collection to access the collection of projects. Includes StartProject, FileName, Add, Item, Remove, SaveAs, etc. A VBProject includes BuildFileName, Description, FileName, Type, References, VBComponents, ReadProperty, WriteProperty, etc. A VBComponent includes CodeModule, Designer, IsDirty, Name, Properties, Type, etc, as well as Activate, InsertFile, ReadProperty, WriteProperty, Reload, and SaveAs methods. Use the CodePanes collection to access the collection of code panes. Includes Count, Item. A CodePane includes CodeModule, CodePaneView, CountOfVisibleLines, TopLine, GetSelection, SetSelection, etc. A CodeModule includes AddFrom.., CountOfLines, Members, Find, ProcLines, DeleteLines, InsertLine, ReplaceLine, etc. Use the CommandBars collection to access the collection of command bars. This collection belongs to the Microsoft Office 8.0 Object Library. Includes Add, Count, Item, DisplayTooltips, MenuAnimationStyle, etc. Use the Events object to connect all Visual Basic for Applications events. All objects in this model have a VBE property that points to the VBE object. ' Top-level extensibility object. With VBInstance ' As VBIDE.VBE .ActiveCodePane ' As CodePane - Returns the active or last active CodePane _ object or sets the active CodePane object. .ActiveVBProject ' As VBProject - Returns the active project in the Project window. .ActiveWindow ' As Window - Returns the active window. .Addins ' As Addins - Returns the Addins collection. .CodePanes ' As CodePanes - Returns the collection of active CodePane objects. .CommandBars ' As CommandBars - Contains all of the command bars in a project, _ including command bars that support shortcut menus. .DisplayModel ' As vbext_VBADisplayModel - Returns or sets the display model used _ by the system. .Events ' As Events - Returns the Events Object. .FullName ' As String - Returns the full path name of the Visual Basic exe. .LastUsedPath ' As String - Returns or sets the last path used in a file dialog box. .MainWindow ' As Window - Returns a Window object representing the main window of _ the Visual Basic development environment. .Name ' As String - Returns a String containing the name of the object. _ (default member of VBIDE.VBE) .ReadOnlyMode ' As Integer - Returns or sets a value that determines how the VB _ development environment interacts with read-only files. .SelectedVBComponent ' As VBComponent - Returns the selected component. .TemplatePath ' As String - Returns the fully qualified path location for template files. .VBProjects ' As VBProjects - Returns the VBProjects collection, representing all the _ projects that are open in the development environment. .Version ' As String - Returns a String containing the version of Visual Basic _ for Applications that the application is using. .Windows ' As Windows - Returns the collection of Window objects. ' .Quit() ' Attempts to exit the development environment. End With VBIDE.vbext_VBADisplayModel vbext_dm_MDI vbext_dm_SDI End Enum ' The collection of all windows in the development environment. With .Windows ' As Windows .Count ' As Long - Returns the number of items in the collection. .Parent ' As VBE - Returns the parent VBE object. ' .CreateToolWindow() ' As Window - Creates a new Tool window containing the indicated DocObject. .Item() ' As Window - (default member) Returns the indexed item from the collection, _ where index is the name or index number of the item. End With View VBToolWindAddin.htm (Use back button) 'With .MainWindow ' As Window ' Returns a Window object representing the main window of the Visual Basic development ' environment. You can use the Window object returned by the MainWindow property to add ' or remove docked windows. You can also use the Window object returned by the MainWindow ' property to maximize, minimize, hide, or restore the main window of the VB IDE. ' The Window object represents a window in the development environment. With .ActiveWindow ' As Window .Caption ' As String - Returns the title of the active window. .Collection ' As Windows - Returns the Windows collection that contains the Window. .Height ' As Long - Returns or sets the height of the window in twips. .Left ' As Long - Returns or sets the left edge on the screen in twips. .LinkedWindowFrame ' As Window - Returns the Window object frame that contains the window. .LinkedWindows ' As LinkedWindows - Returns the collection of all linked windows _ contained in a linked window frame. .Top ' As Long - Returns or sets the top of the window on the screen in twips. .Type ' As vbext_WindowType - Returns the type of window. .Visible ' As Boolean - Returns or sets the visibility of the window. .Width ' As Long - Returns or sets the width of the window in twips. .WindowState ' As vbext_WindowState - Returns or sets the visual state of the window. ' .Close() ' Closes the window. .SetFocus() ' Moves the focus to the window. End With VBIDE.vbext_WindowType vbext_wt_Browser vbext_wt_CodeWindow vbext_wt_ColorPalette vbext_wt_Designer vbext_wt_Find vbext_wt_FindReplace vbext_wt_Immediate vbext_wt_LinkedWindowFrame vbext_wt_Locals vbext_wt_MainWindow vbext_wt_Preview vbext_wt_ProjectWindow vbext_wt_Toolbox vbext_wt_Watch End Enum VBIDE.vbext_WindowState vbext_ws_Maximize vbext_ws_Minimize vbext_ws_Normal End Enum 'With .ActiveWindow.LinkedWindows ' As LinkedWindows 'With .Windows(0).LinkedWindows ' As LinkedWindows With .MainWindow.LinkedWindows ' As LinkedWindows .Count ' As Long - Returns the number of items in the collection. ' .Add() ' Adds a Window object to the collection. .Item() ' As Window - (default member) Returns a Window object from the collection. .Remove() ' Removes a Window item from the collection. End With ' The collection of all AddIn objects that are accessible in the IDE. With .Addins ' As Addins .Count ' As Long - Returns the number of items in a collection. .Parent ' As VBE - Returns the parent VBE object. ' .Item() ' As Addin - (default member) Returns the specified item from the collection. .Update() ' Refreshes the Addins collection from the registry just as if the user _ had opened the Add-in Manager dialog box. End With ' The AddIn object provides information about an add-in for other add-ins. With .Addins.Item(0) ' As Addin .Collection ' As Addins - Returns the collection that contains the add-in. .Connect ' As Boolean - Returns or sets the connected state of an add-in. .Description ' As String - (default member) Returns or sets the description associated _ with the add-in. Can be set only in the OnConnection Event. .Guid ' As String - Returns the class identifier of the add-in. .Object ' As Object - Returns or sets the object returned by the add-in. _ Can be set only in the OnConnection event. .ProgId ' As String - Returns the progID of the add-in. End With AddinInstance ' AddInDesignerObjects events. ' Represents all the projects that are open in the development environment. With .VBProjects ' As VBProjects .Count ' As Long - Returns the number of items in the collection. .IconState ' As vbextSCCStatus - Returns or sets the source code control _ icon or 'glyph' for the project in the _ project window, indicating its status. .Parent ' As VBE - Returns the parent VBE object. .StartProject ' As VBProject - Returns or sets the project that will be _ started when the user presses the F5 key. ' .Add() ' As VBProject - Adds a new VBProject object to the collection. .AddFromFile() ' As VBNewProjects - Adds or opens a project or group project _ and returns a collection of all projects added using AddFromFile. .AddFromTemplate() ' As VBNewProjects - Creates a new project using an existing project _ as a template and returns a collection that contains all projects _ added using AddFromTemplate. .FileName() ' As String - Returns the fully qualified path to the group project file. .Item() ' As VBProject - (default member) Returns the indexed item from the collection, _ where index is the name or index number of the item. .Remove() ' Removes a VBProject item from the collection. .SaveAs() ' Saves to a specified location using a new file name. ' ItemActivated ' Occurs after a VBProject is activated. Events ItemAdded ' Occurs after a VBProject is added. ItemRemoved ' Occurs after a VBProject is removed. ItemRenamed ' Occurs after a VBProject is renamed. End With 'With .VBProjects.AddFromTemplate() ' As VBNewProjects ' Represents all the projects added as a result of an AddFrom.. operation. With .VBProjects.AddFromFile() ' As VBNewProjects Count ' As Long - Returns the number of objects in the collection. ' Item() ' As VBProject - (default member) Returns the specified item from the collection. End With 'With .VBProjects(0) ' As VBProject 'With .VBProjects.StartProject ' As VBProject ' Use the VBProject object to set properties for the project, to access ' the VBComponents collection, and to access the References collection. With .ActiveVBProject ' As VBProject .BuildFileName ' As String - Returns or sets a String containing the .exe or .dll name _ that will be used when the project is built. .Collection ' As VBProjects - Returns the collection ??? .CompatibleOleServer ' As String - Returns or sets a String containing the compatible Automation _ server for the project. .Description ' As String - Returns or sets a string description of the project. .FileName ' As String - Returns or sets the path and file name. .HelpContextID ' As Long - Returns or sets the context ID for a topic in the Ms Help file. .HelpFile ' As String - Returns or sets a String specifying the Microsoft Windows Help. .IconState ' As vbextSCCStatus - Returns or sets the source code control icon or 'glyph' _ for the project in the Project window, indicating the project's status. .IsDirty ' As Boolean - Returns a Boolean value indicating whether or not the object _ was edited since the last time it was saved. .Name ' As String - Returns (or sets?) the Project Name. .References ' As References - Returns the set of references in the project. .Saved ' As Boolean - Returns a Boolean indicating whether the project has been saved. .StartMode ' As vbext_ProjectStartMode - Returns or sets the start mode of the project. .Type ' As vbext_ProjectType - Returns the type of the project. .VBComponents ' As VBComponents - Returns the components contained in the project. ' .AddToolboxProgID() ' Places a control or embedded component in the toolbox & adds a project reference. .MakeCompiledFile() ' Writes out the project as an exe, dll, or ocx, depending on the project type. .ReadProperty() ' As String - Reads custom sections and values from the .vbp file. .SaveAs() ' Saves to a specified location using a new file name. .WriteProperty() ' Writes custom sections and values to the .vbp file. End With FileControlEvents ' Project file control events. VBIDE.vbext_ProjectStartMode vbext_psm_OleServer vbext_psm_StandAlone End Enum VBIDE.vbext_ProjectType vbext_pt_ActiveXControl vbext_pt_ActiveXDll vbext_pt_ActiveXExe vbext_pt_StandardExe End Enum VBIDE.vbextSCCStatus vbextSCCStatusCheckedOut ' File is checked out to the current user vbextSCCStatusControlled ' File is under source code control vbextSCCStatusNotControlled ' File is not under source code control vbextSCCStatusOutOfDate ' File is not the most recent vbextSCCStatusOutOther ' File is checked out to another user vbextSCCStatusShared ' File is shared between projects End Enum ' Returns the set of references in the project. With .VBProjects(0).References ' As References .Count ' As Long - Returns the number of items in the collection. .Parent ' As VBProject - Returns the parent object or collection. ' .AddFromFile() ' As Reference - Adds a reference to a project from a file. .AddFromGuid() ' As Reference - Adds a reference to the References collection using _ the globally unique identifier (GUID) of the reference. .Item() ' As Reference - (default member) Returns the indexed item from the collection, _ where index is the name or index number of the item. .Remove() ' Removes a Reference item from a collection. ' ItemAdded ' (default member) Occurs after a Reference is added. Events ItemRemoved ' Occurs after a Reference is removed from a project. End With ' Represents a reference to a type library or a project. With .VBProjects(0).References(0) ' As Reference .BuiltIn ' As Boolean - Returns whether the reference is a default reference that can't be removed. .Collection ' As References - Returns the collection that contains the object. .Description ' As String - Returns a description associated with the reference. .FullPath ' As String - Returns the path and file name of the reference. .Guid ' As String - Returns the class identifier of the reference. .IsBroken ' As Boolean - Returns whether the Reference object points to a valid reference in the registry. .Major ' As Long - Returns the major version number of the reference. .Minor ' As Long - Returns the minor version number of the reference. .Name ' As String - Returns the name used in code to identify the reference. .Type ' As vbext_RefKind - Returns the type of object. End With VBIDE.vbext_RefKind vbext_rk_Project vbext_rk_TypeLib End Enum 'With .VBProjects.StartProject.VBComponents ' As VBComponents 'With .ActiveVBProject.VBComponents ' As VBComponents ' Represents the components contained in a project. With .VBProjects(0).VBComponents ' As VBComponents .Count ' As Long - Returns the number of items in the collection. .Parent ' As VBProject - Returns the parent VBProject object. .StartUpObject ' As Variant - Returns the startup component for the project. The returned _ variant contains either an enumerated vbext_StartupObject value _ or a VBComponent object that represents the startup object. ' .Add() ' As VBComponent - Adds an object to the collection. .AddCustom() ' As VBComponent - Creates a new component and returns it. .AddFile() ' As VBComponent - Creates a new component from file and returns it. .AddFromTemplate() ' As VBComponent - Creates a new component from a template and returns it. .Item() ' As VBComponent - (default member) Returns the indexed item from the collection, _ where index is the name or index number of the item. .Remove() ' Removes a VBComponent item from the collection. ' ItemActivated ' Occurs after a VBComponent is activated. Events ItemAdded ' Occurs after a VBComponent is added. ItemReloaded ' Occurs after a VBComponent is reloaded ItemRemoved ' Occurs after a VBComponent is removed. ItemRenamed ' Occurs after a VBComponent renamed. ItemSelected ' Occurs after a VBComponent is selected. End With VBIDE.vbext_StartupObject vbext_so_None vbext_so_SubMain End Enum 'With .ActiveCodePane.CodeModule.Parent ' As VBComponent 'With .CodePanes(0).CodeModule.Parent ' As VBComponent 'With .ActiveVBProject.VBComponents(0) ' As VBComponent 'With .VBProjects(0).VBComponents(0) ' As VBComponent ' The SelectedVBComponent property returns the selected component in the Project window. ' If the selected item isn't a component, SelectedVBComponent returns Nothing. ' Represents a form or class module, user document, standard module, etc. With .SelectedVBComponent ' As VBComponent .CodeModule ' As CodeModule - Returns an object representing the code behind the component. .Collection ' As VBComponents - Returns the collection that contains the object. .Description ' As String .Designer ' As Object - Returns the object that enables you to access the design _ characteristics of a component. .DesignerID ' As String .FileCount ' As Integer - Returns the number of files associated with the component. .FileNames ' As String - Returns the names of the files associated with a component. .HasOpenDesigner ' As Boolean - Returns a Boolean value indicating whether or not the _ VBComponent object has an open designer. .HelpContextID ' As Long .IconState ' As Long - Returns or sets the source code control icon or 'glyph' for _ the project in the project window, indicating its status. .IsDirty ' As Boolean - Returns whether edited since the last time it was saved. .Name ' As String - Returns or sets the name of the component. .Properties ' As Properties - Returns the properties of the object. .Type ' As vbext_ComponentType - Returns the type of object. ' .Activate() ' Activates the component. .DesignerWindow() ' As Window - Returns the Window object that represents the component's designer. .InsertFile() ' Inserts code from a file into the code module. .ReadProperty() ' As String - Returns the specified user-defined section and key in the component file. .Reload() ' Reloads the object from disk. .SaveAs() ' As Boolean - Saves the component using a new file name. .WriteProperty() ' Writes custom sections and values to the component files. End With ' Determine the Type of Designer object With .SelectedVBComponent ' As VBComponent Select Case .Type ' As VBIDE.vbext_ComponentType Case vbext_ct_ClassModule, vbext_ct_RelatedDocument, _ vbext_ct_ResFile, vbext_ct_StdModule ' Designer == Nothing Case vbext_ct_ActiveXDesigner, vbext_ct_DocObject, vbext_ct_UserControl, _ vbext_ct_PropPage, vbext_ct_MSForm, vbext_ct_VBForm, vbext_ct_VBMDIForm 'If .HasOpenDesigner Then Dim frm As VBIDE.VBForm Set frm = .Designer 'End If End Select End With ' Contains the active code panes in the VBE object. With .CodePanes ' As CodePanes .Count ' As Long - Returns the number of items in a collection. .Parent ' As VBE - Returns the parent VBE object. ' .Item() ' As CodePane - (default member) Returns the specified item from the collection. End With 'With .CodePanes(0) ' As CodePane 'With .SelectedVBComponent.CodeModule.CodePane ' As CodePane ' The code pane window in which code is displayed. With .ActiveCodePane ' As CodePane .CodeModule ' As CodeModule - Returns the code module associated with the CodePane. .CodePaneView ' As vbext_CodePaneview - Specifies the code pane view. .Collection ' As CodePanes - Returns the collection that contains the code panes. .CountOfVisibleLines ' As Long - Number of lines visible in the code pane. .TopLine ' As Long - The line number of the line at the top of the code pane or _ sets the line showing at the top of the code pane. .Window ' As Window - Returns the window in which the code pane is displayed. ' .GetSelection() ' Returns the StartLine, StartColumn, EndLine and EndColumn _ co-ordinates of the selection in a code pane. .SetSelection() ' Sets the selection in the code pane. .Show() ' Makes the specified code pane the visible code pane in its window. End With VBIDE.vbext_CodePaneview vbext_cv_ProcedureView vbext_cv_FullModuleView End Enum 'With .SelectedVBComponent.CodeModule ' As CodeModule ' Represents the code behind a component, such as a form, class, or document. With .CodePanes(0).CodeModule ' As CodeModule .CodePane ' As CodePane - Returns the code pane associated with the CodeModule. .CountOfDeclarationLines ' As Long - Returns the number of lines in the declarations section. .CountOfLines ' As Long - Returns the number of lines of code in a code module. .Lines ' As String - Returns the specified block of lines. .Members ' As Members - Contains identifiers that have module-level scope and can be _ considered properties, methods, or events of the code module. .Parent ' As VBComponent - Returns the parent VBComponent object. .ProcBodyLine ' As Long - Returns the first line of a procedure (see also ProcStartLine). _ Argument ProcKind As vbext_ProcKind .ProcCountLines ' As Long - Returns the number of lines in the specified procedure. .ProcOfLine ' As String - Returns the name of procedure that contains the specified line. .ProcStartLine ' As Long - Returns the line at which the specified procedure begins. ' .AddFromFile() ' Adds the contents of a file to a module. .AddFromString() ' Inserts text, starting on the line preceding the first procedure. _ If no procedures, places the text at the end of the module. .CreateEventProc() ' Creates an event procedure. Returns a Long. .DeleteLines() ' Deletes a single line of code or a specified range of lines. .Find() ' Searches a code module for a specified string. Returns True if found. .InsertLines() ' Inserts a line or lines of code at the specified location. .ReplaceLine() ' Replaces an existing line of code with a specified line of code. End With VBIDE.vbext_ProcKind vbext_pk_Get ' Specifies a procedure that returns the value of a property. vbext_pk_Let ' Specifies a procedure that assigns a value to a property. vbext_pk_Proc ' Specifies all procedures other than property procedures. vbext_pk_Set ' Specifies a procedure that sets a reference to an object. End Enum With .CodePanes(0).CodeModule.Members ' As Members .Count ' As Long - Returns the number of items in the collection. .Parent ' As CodeModule - Returns the parent CodeModule object. ' .Item() ' As Member - (default member) Returns the specified item from the collection. End With 'With .SelectedVBComponent.CodeModule.Members(0) ' As Member ' Represents a mixture of code-based properties and ' type library-based attributes of public members. With .CodePanes(0).CodeModule.Members(0) ' As Member .Bindable ' As Boolean - Returns or sets the Bindable attribute. .Browsable ' As Boolean - Returns or sets the Browsable attribute .Category ' As String .CodeLocation ' As Long - Returns the line where the member is defined. .Collection ' As Members - (default member) Returns the collection that contains the object. .DefaultBind ' As Boolean - Returns or sets the DefaultBind attribute. .Description ' As String - Returns or sets string description associated with the object. .DisplayBind ' As Boolean - Returns or sets the DisplayBind attribute. .HelpContextID ' As Long - Returns or sets a String containing the context ID for a topic _ in a Microsoft Windows Help file. .Hidden ' As Boolean - Returns or sets the hidden attribute. .Name ' As String - Returns or sets the name used in code to identify an object. .PropertyPage ' As String .RequestEdit ' As Boolean - Returns or sets the RequestEdit attribute. .Scope ' As vbext_Scope - Returns the scope. .StandardMethod ' As Long - Returns or sets the DispID attribute. .Static ' As Boolean - Returns True if the member is static. .Type ' As vbext_MemberType - Returns the member type. .UIDefault ' As Boolean - Returns or sets the UIDefault attribute. End With VBIDE.vbext_Scope vbext_Friend vbext_Private vbext_Public End Enum VBIDE.vbext_MemberType vbext_mt_Const vbext_mt_Event vbext_mt_Method vbext_mt_Property vbext_mt_Variable End Enum 'With .ActiveVBProject.VBComponents(0).Designer ' As VBForm ' Represents a graphical designer object in a project. The components ' Type property is one of the vbext_ComponentType enumeration values. With .SelectedVBComponent.Designer ' As VBForm .CanPaste ' As Boolean - Returns True if the contents of the Clipboard can be pasted to the form. .ContainedVBControls ' As ContainedVBControls - Returns the collection of contained controls on the form. _ These are the controls placed directly on the form's surface. .Parent ' As VBComponent - Returns the parent object or collection. .SelectedVBControls ' As SelectedVBControls - Returns a collection of selected controls on the form. .VBControls ' As VBControls - Returns a collection containing all controls on the form. ' .Paste() ' Pastes the contents of the Clipboard onto the form. .SelectAll() ' As Long - Selects all the controls contained on the form. End With ' Represents a collection of VBControl objects. With .SelectedVBComponent.Designer.VBControls ' As VBControls .Count ' As Long - Returns the number of objects in the collection. .Parent ' As Object - Returns the parent (Designer) object. ' .Add() ' As VBControl - Adds an object to the collection. .Item() ' As VBControl - (default member) Returns the indexed item from the collection, _ where index is the name or index number of the item. .Remove() ' Removes an item from the collection. ' ItemAdded ' Occurs after a control is added. Events ItemRemoved ' Occurs after a control is removed. ItemRenamed ' Occurs after a control is renamed. End With ' Returns a collection of selected VBControl objects. With .SelectedVBComponent.Designer.SelectedVBControls ' As SelectedVBControls .Count ' As Long - Returns the number of objects in the collection. .Parent ' As VBForm - Returns the parent VBForm object. ' .Clear() ' As Long - Removes all objects from the collection. .Copy() ' Copies the selected controls to the Clipboard. .Cut() ' Deletes the selected controls from the form. .Item() ' As VBControl - (default member) Returns the specified item from the collection. ' ItemAdded ' Occurs after a control is added. Events ItemRemoved ' Occurs after a control is removed. End With ' Represents a collection of contained VBControl objects. With .SelectedVBComponent.Designer.ContainedVBControls ' As ContainedVBControls .Count ' As Long - Returns the number of objects in the collection. .Parent ' As Object - Returns the parent object. ' .Add() ' As VBControl - Adds an object to the collection. .Item() ' As VBControl - (default member) Returns the specified item from the collection. .Remove() ' Removes an item from the collection. End With 'With .SelectedVBComponent.Designer.VBControls(0) ' As VBControl 'With .SelectedVBComponent.Designer.SelectedVBControls(0) ' As VBControl 'With .SelectedVBComponent.Designer.ContainedVBControls(0) ' As VBControl ' If a control can act as a container - as is the case with picture boxes and ' frames - it exposes a ContainedVBControls collection. This collection holds ' one or more VBControl objects, which in turn might be containers themselves. With .VBProjects(0).VBComponents(0).Designer.VBControls(0) ' As VBControl .ClassName ' As String - (default member) Returns the class name of the control. .Collection ' As VBControls - Returns the collection that contains this object. .ContainedVBControls ' As ContainedVBControls - Returns the collection of contained controls. .Container ' As Object - Returns the containing control or form. .ControlObject ' As Object - Returns the Control object. .ControlType ' As vbext_ControlType - Returns the type of the control. .InSelection ' As Boolean - Returns True if the control is selected. .ProgId ' As String - Returns the ProgID of the control. .Properties ' As Properties - Represents the properties of the object. ' .ZOrder() ' As VBControl - Places a specified object at the front or back _ of the z-order within its graphical level. End With VBIDE.vbext_ControlType vbext_ct_Container vbext_ct_Light vbext_ct_Standard End Enum 'With .VBProjects(0).VBComponents(0).Properties ' As Properties 'With .SelectedVBComponent.Properties ' As Properties With .SelectedVBComponent.Designer.VBControls(0).Properties ' As Properties .Count ' As Long - Returns the number of items in the collection. .Parent ' As Object - Returns the parent object or collection. ' .Item() ' As Property - Returns the indexed item from the collection, _ where index is the name or index number of the item. End With 'With .VBProjects(0).VBComponents(0).Designer.VBControls(0).Properties(0) ' As Property ' Represents a property of an object. With .VBProjects(0).VBComponents(0).Properties(0) ' As Property .Collection ' As Properties - Returns the collection that contains the object. .IndexedValue ' Returns or sets a value that requires an index. .Name ' As String - Returns the name used in code to identify the object. .NumIndices ' As Integer - Returns the number of indices on the property. .Object ' As Unknown - Returns or sets the object returned by the property. .Value ' As Variant - (default member) Returns or sets the value of an object. End With ' A collection of CommandBar objects that represent the command bars in the IDE. With .CommandBars ' As CommandBars .ActionControl ' As CommandBarControl - Returns the CommandBarControl object whose _ OnAction property is set to the running procedure. .ActiveMenuBar ' As CommandBar - Returns the object that represents the active menu bar. .Application ' As Object .Count ' As Long .Creator ' As Long .DisplayKeysInTooltips ' As Boolean .DisplayTooltips ' As Boolean .LargeButtons ' As Boolean .MenuAnimationStyle ' As MsoMenuAnimation .Parent ' As Object ' .Add() ' As CommandBar .Item() ' As CommandBar - (default member) index is the name or index number of the item. .FindControl() ' As CommandBarControl .ReleaseFocus() ' Releases the user interface focus from all command bars. End With ' Note: You can use the name or index number to specify a menu bar or toolbar ' in the list of available menu bars and toolbars in the development environment. ' However, you must use the name to specify a menu, submenu, or context menu. Office.MsoMenuAnimation msoMenuAnimationNone msoMenuAnimationRandom msoMenuAnimationSlide msoMenuAnimationUnfold End Enum 'With .CommandBars(0) ' As CommandBar With .CommandBars.ActiveMenuBar ' As CommandBar .Application ' As Object .BuiltIn ' As Boolean .Context ' As String .Controls ' As CommandBarControls .Creator ' As Long .Enabled ' As Boolean .Height ' As Long .Index ' As Long .Left ' As Long .Name ' As String .NameLocal ' As String .Parent ' As Object .Position ' As MsoBarPosition .Protection ' As MsoBarProtection .RowIndex ' As Long .Top ' As Long .Type ' As MsoBarType .Visible ' As Boolean .Width ' As Long ' .Delete() ' .FindControl() ' As CommandBarControl .Reset() ' Reset the menu to its default appearance .ShowPopup() ' End With Office.MsoBarPosition msoBarBottom ' Indicates where the command bar appears on the screen. msoBarLeft msoBarRight msoBarTop ' msoBarFloating ' Indicates that the command bar isn't docked. msoBarMenuBar ' Indicates that the command bar is a Macintosh® only system menu bar. This constant _ is incorrectly listed as msoBarMenu in the Help topic for the Position property. msoBarPopup ' Read-only. Indicates that the command bar is a shortcut context menu. End Enum Office.MsoBarProtection msoBarNoChangeDock msoBarNoChangeVisible msoBarNoCustomize msoBarNoHorizontalDock msoBarNoMove msoBarNoProtection msoBarNoResize msoBarNoVerticalDock End Enum Office.MsoBarType msoBarTypeMenuBar ' Used for creating custom menu bars. msoBarTypeNormal ' The familiar toolbar command bar. msoBarTypePopup ' Context menus, displayed by right-clicking. End Enum ' Print all the context menus in the Immediate window Dim CBar As CommandBar For Each CBar In .CommandBars If CBar.Type = msoBarTypePopup Then Debug.Print CBar.Name End If Next ' Create a context menu using the Position argument Dim mymenubar As CommandBar Set mymenubar = CommandBars.Add(Name:="MyPopup", Position:=msoBarPopup) ' Note: You can use the Add method to create a context menu, but you can't change ' an existing command bar of another type to a context menu. Although the Position ' property for command bars has an msoBarPopup setting, this setting is read-only; ' it is used to determine whether an existing command bar is a pop-up menu. ' You can't set this property to change the type of a command bar to msoBarPopup. View AddCommandBars.htm (Use back button) With .CommandBars(0).Controls ' As CommandBarControls .Application ' As Object .Count ' As Long .Creator ' As Long .Parent ' As CommandBar ' .Add() ' As CommandBarControl .Item() ' As CommandBarControl - (default member) index is the name or index number of the item. End With 'With .CommandBars(0).Controls(0) ' As CommandBarControl With .CommandBars.ActionControl ' As CommandBarControl .Application ' As Object .BeginGroup ' As Boolean .BuiltIn ' As Boolean .Caption ' As String .Creator ' As Long .DescriptionText ' As String .Enabled ' As Boolean .Height ' As Long .HelpContextID ' As Long .HelpFile ' As String .Id ' As Long .Index ' As Long .Left ' As Long .OLEUsage ' As MsoControlOLEUsage .OnAction ' As String .Parameter ' As String .Parent ' As CommandBar .Priority ' As Long .Tag ' As String .ToolTipText ' As String .Top ' As Long .Type ' As MsoControlType .Visible ' As Boolean .Width ' As Long ' .Copy() ' As CommandBarControl .Delete() ' .Execute() ' .Move() ' As CommandBarControl .Reset() ' .SetFocus() ' End With Office.MsoControlOLEUsage msoControlOLEUsageBoth msoControlOLEUsageClient msoControlOLEUsageNeither msoControlOLEUsageServer End Enum ' There are three types of command bars: Office.MsoControlType ' A Popup command bar is equivalent to a menu item on a menu bar. msoControlPopup msoControlButtonPopup msoControlGraphicPopup msoControlSplitButtonMRUPopup msoControlSplitButtonPopup ' A ComboBox command bar is similar to a ComboBox control. That is, a toolbar ' button with a dropdown arrow next to it (like the Add Project toolbar button). ' When you click the arrow, it displays more menu commands with icons. msoControlComboBox msoControlButtonDropdown msoControlDropdown msoControlEdit msoControlGraphicCombo msoControlGraphicDropdown msoControlOCXDropdown msoControlSplitDropdown ' A Button command bar is equivalent to a standard toolbar button. ' That is, a button with an icon displayed on it. msoControlButton ' msoControlCustom msoControlExpandingGrid msoControlGauge msoControlGenericDropdown msoControlGrid msoControlLabel msoControlSplitExpandingGrid End Enum View TypeProp.htm (Use back button) ' CommandBarPopup ' The Type property of the CommandBarControl is msoControlPopup, msoControlGraphicPopup, ' msoControlButtonPopup, msoControlSplitButtonPopup, or msoControlSplitButtonMRUPopup. ' A Popup command bar is equivalent to a menu item on a menu bar. With .CommandBars(0).Controls(0) ' As CommandBarPopup .Application ' As Object .BeginGroup ' As Boolean .BuiltIn ' As Boolean .Caption ' As String .CommandBar ' As CommandBar .Controls ' As CommandBarControls .Creator ' As Long .DescriptionText ' As String .Enabled ' As Boolean .Height ' As Long .HelpContextID ' As Long .HelpFile ' As String .Id ' As Long .Index ' As Long .Left ' As Long .OLEMenuGroup ' As MsoOLEMenuGroup .OLEUsage ' As MsoControlOLEUsage .OnAction ' As String .Parameter ' As String .Parent ' As CommandBar .Priority ' As Long .Tag ' As String .ToolTipText ' As String .Top ' As Long .Type ' As MsoControlType .Visible ' As Boolean .Width ' As Long ' .Copy() ' As CommandBarControl .Delete() ' .Execute() ' .Move() ' As CommandBarControl .Reset() ' .SetFocus() ' End With Office.MsoOLEMenuGroup msoOLEMenuGroupContainer msoOLEMenuGroupEdit msoOLEMenuGroupFile msoOLEMenuGroupHelp msoOLEMenuGroupNone msoOLEMenuGroupObject msoOLEMenuGroupWindow End Enum ' CommandBarComboBox ' The Type property of the CommandBarControl is msoControlEdit, msoControlDropdown, ' msoControlComboBox, msoControlButtonDropdown, msoControlSplitDropdown, ' msoControlOCXDropdown, msoControlGraphicCombo, or msoControlGraphicDropdown. ' A ComboBox command bar is similar to a ComboBox control. That is, a toolbar ' button with a dropdown arrow next to it (like the Add Project toolbar button). ' When you click the arrow, it displays more menu commands with icons. With .CommandBars(0).Controls(0) ' As CommandBarComboBox .Application ' As Object .BeginGroup ' As Boolean .BuiltIn ' As Boolean .Caption ' As String .Creator ' As Long .DescriptionText ' As String .DropDownLines ' As Long .DropDownWidth ' As Long .Enabled ' As Boolean .Height ' As Long .HelpContextID ' As Long .HelpFile ' As String .Id ' As Long .Index ' As Long .Left ' As Long .List() ' As String .ListCount ' As Long .ListHeaderCount ' As Long .ListIndex ' As Long .OLEUsage ' As MsoControlOLEUsage .OnAction ' As String .Parameter ' As String .Parent ' As CommandBar .Priority ' As Long .Style ' As MsoComboStyle .Tag ' As String .Text ' As String .ToolTipText ' As String .Top ' As Long .Type ' As MsoControlType .Visible ' As Boolean .Width ' As Long ' .AddItem() ' .Clear() ' .Copy() ' As CommandBarControl .Delete() ' .Execute() ' .Move() ' As CommandBarControl .RemoveItem() ' .Reset() ' .SetFocus() ' End With Office.MsoComboStyle msoComboLabel msoComboNormal End Enum ' CommandBarButton ' The Type property of the CommandBarControl is msoControlButton. ' A Button command bar is equivalent to a standard toolbar button. ' That is, a button with an icon displayed on it. With .CommandBars(0).Controls(0) ' As CommandBarButton .Application ' As Object .BeginGroup ' As Boolean .BuiltIn ' As Boolean .BuiltInFace ' As Boolean .Caption ' As String .Creator ' As Long .DescriptionText ' As String .Enabled ' As Boolean .FaceId ' As Long .Height ' As Long .HelpContextID ' As Long .HelpFile ' As String .Id ' As Long .Index ' As Long .Left ' As Long .OLEUsage ' As MsoControlOLEUsage .OnAction ' As String .Parameter ' As String .Parent ' As CommandBar .Priority ' As Long .ShortcutText ' As String .State span> .Priority 'lass="comment">' As Long .HelpFile ' As String .Id ' As Long .Index' A Bud P/sp A Bud "event">msoBarMenuBar">Propan clasrght class="c A Bud' As Lon9 ' As Long ' As Lon9 <">msoBarMenuBar">Prop,o ' A Button command b class="c Apan>' As Object ' An>' As Lon <"'With .VBProjects(0).VBComponents(pan clat">' As Lon <"' As Lon ss="comment">' CommandBarButtonmsoBarMenuBar">Propan clasrght lsPropan clasrght ls'With .VBlTipTexects(0).VBComponents(0).Designer.VBContring class="event">0s="ceAevea htrol<"' As Lon ss="cs simdiiiispa 0s="ceACpan cla d an icon d clr ="comme solOLEUm>' As Boolean' As CommandBarControl .RemoveItem() ' As CommandBarControl .RemoveItem() ' As CommandBarControl .RemDou>'an clveItem() 'lass="comment">n ' As Boolean .Caption n>' As Lon <" .Caption rtoxs="comment">'b class="event">msrcn> cnt pan> ' The Type pr Bar">Propan clasrghton command b class="c Apan>' ag cnt pan> ' Aa> e clalass="identifirpan class="identifier">CBar' aeos="identifier">.ExecutCpan cla d an icon d clr =spact">' aeos="identifier">.ExecutCpan cla d an icon d clr =spact">' aeos="identifier">.ExecutCpan cla d an icon oBox e class="comment">' cn> ord">End Enu>"event">nt">' ag cnt n> cn> ord">End Enu>"event">nt">' ag cnt n> cn> ord">End Enu>"event">nt">' ag cnt n> cn> ord">End Enu>"event">nt">' ag cnt n> cn> or ord"Ce'c cn> ord">End Enu>"event">nt">' ag ntIn e n> cn> ord">End Enu> Dim rghton a' The Type pr cnt ordv cla cn> ord"entifispan> ' ag MsoOLEMenuGcommt n> cn> ord">End Enu> ' As MsDelete()"event">nt">' ag ' An>' As Lon <"'With .VBProjects(0).VBComponents(p n>' Aa> ' As String' Dim rghton a' The Type pr ="coa a.RemDcomment">' As Long ' As String dentifier">.Priority .ExecutCpan cPcs="cdtso' As LonVBControl<"dl ' As e="idenAnim"idt">' As e="n ceent"bpan>.Priority .ExecutCpan cPcs="cdtsan class="comment">' As Long ' As Long' As e="idenAnim"lass="i">' As Long' As e="ideng' As e="idenAnim"lass="i">' As Long Long'uam() up ' As e="idenAnim"idt"i0icaaderCount End En ord">End Enu>"event">nt">' ag ' As Long .DescriptionText 'er">"evendng .Eneevent">msoControlOLEUsageClient n class="comment">' As Long .ExecutCpan cla d an icon d clr =spact">' aeos="identifier">.ExecutCpan cla d an icon oBox ' As CommandBar' t">' an icon d clr =spact">' aeos="identifierd toolbar buttoeeItem() tifier">.Hc aeos="idD: cn iconn> tcnt pan> act">' aeos="identifier">Ean class="eD: You ' As CommandBar n class="commes="identifier">.Exec .Top act">' aeos="identifier">.Execocus Com"cdfie' ag eusndssn> .Execuneos=dentifier">.CommandBars.ActionControl ean> cocu' As LoarControl is msoControlBuVthe CommandBarControos C ent">muoLabeacs="cdtsan class="n os="ide,vContr a 'lass="commenyh="event">msoComboNormal CommandBar . '9boN"ide,vContr a ' As CommandBar' t">' an icon daa,C0 an class="Con="comANntifier" CommandBacpan eMxc os="iBarelButtxifnlasaief="#cmdb">Com pfr/sparru ="coment Vthe CommandBarControl is msoControlButtxispan>nt">' ag"event">nt">' ag ' As Long .Execocus Com"cdfie' ag cnt pan> ' Asfnumment">' > Office.MsoComboStyle msoComboLabel msoComboNormal End Enum "event"' Ass="identifierer">.Exhtss="event">msoComboNormalact">' aeos="identifier">.ExecutCpacs="cdtsan class="n class="event">msoComboLabel .ExecutCpacs="cdtsan class="n class="tltm ent">muoLabeacs="cdtsan class="n os="identifi' As cclass="identifier">.Parent Vthe CommandBarControl is msoControlButtxispan>.Execuneos=dentifier">.CommandBaelete() .Comms LD onVBControl<"d b">CommanyI pfr>msoControlBut">.OnAction ' b s="i b">ntIn e' As Long letcY Objectact">' aeos="identifier">word""#cmdb">Com rer">.Comms LD ' That is, a button actn> ' As Object ' That is, a bugtion ' b s="i b">ntIn e cn> ord">End Enu>s="ton.s/s="cdts cla d an icon d clr ="comment">' An> ' As ' >End Enu>s="ton.s/s="cdts cla d an icon d clr ="comment">' An> ' AsmsoComboLabel rameter>' tpf>' er
txifnlasai/ #san elassayed on fiernn'="css="textn )tlass"c c' >txifnlasai/ t">s, #s n> rle .Remo fiernn'="css="textn )tlass"c c' >txifnlasai/ '="comment>"event"' Ass="identifierer">.ss="coo fiernn'="css="tn>> .OnAction ' b s=tnnn'="css="t d">msoConroComboSt®an class="coc>.OnAction .sn> >co>' tpf>' er ' As ' As Long ' aeos="identifier">.Extpf>' ndssn> >' aeos="r' b ' b ss="identlass="s="comment">' b s=tnnn'="css="t d">msoConroComboSt®an class="coc>.OnAction .sn> >co>' tpf>' er End EaTControlOLEUsage .Onrer">"event">ntio"comgeenspan>' an icon d ' As ' aeos="identifie>' b ' As Long dntifier"wdeommanPaentifier">CBar
.OnActioos="idD: cn iconn> t ' A">CBar Vthe Commhk b MsoComboStyleo entifoice. ' As e="idenAnim"le e="idenAni.Exvent">nt">' ag< ' b s=tnnn'="css="t d,e' er. MsoComboStyle' As e="idenAnim"le e="idenAni.Exvent">nt">' ag< ' b s