How to activate ArcCatalog from ArcMap


The ShowArcCatalog VBA macro demonstrates how to programmatically start the ArcCatalog application and move the ArcCatalog window from ArcMap. You need to use the Application Running Object Table object, AppROT, to get a reference to any running ArcMap or ArcCatalog application.

How to use

  1. Start ArcMap and paste this code into a module in the Visual Basic editor.
  2. Run the ShowArcCatalog macro. This should start an ArcCatalog application and position the window.
[VBA]
Sub ShowArcCatalog()
    Dim pAppROT As AppROT
    Dim pAppROTCountInt As Integer
    Dim pAppROTCount As Integer
    Dim pCommand As ICommandItem
    Dim pAppWin As IWindowPosition
    Dim i As Integer
    
    Set pAppROT = New AppROT
    pAppROTCountInt = pAppROT.Count
    
    ' Start ArcCatalog in ArcMap
    Set pCommand = Application.Document.CommandBars.Find(ArcID.Tools_Catalog)
    pCommand.Execute
    
    ' Wait for the new ArcCatalog application to be added to AppROT
    Do Until pAppROTCount = (pAppROTCountInt + 1)
        pAppROTCount = pAppROT.Count
    Loop
    
    ' Get a reference to the running ArcCatalog application and move its window
    If TypeOf pAppROT.Item(pAppROTCount - 1) Is IGxApplication Then
        Set pAppWin = pAppROT.Item(pAppROTCount - 1)
        ' Move the ArcCatalog application window
        pAppWin.Move 10, 10, 600, 500
    End If
End Sub