Failed to Import the ActiveX Control

Less than one minute read time.

Over the last couple of years, some partners have had an issue where they were not able to add a VB OCX to a WinForms screen as they would receive a message from Visual Studio stating : "Failed to import the ActiveX control. Please ensure it is registered properly". See this link in the Reports, Macros, and Customizations forum:

We've recently resolved this issue or at least have an immediate solution as we address a long term solution. It seems that the ObjSafe.tlb file is being removed during the installation, likely by an anti-virus program. Since the VB UIs are built with the lObjectSafety implementation, when this file is missing, the axInterop utility complains.

Short Term Solution: Here is a link ( to a zip file containing the ObjSafe.tlb file. Unzip into your Sage Runtime folder and the issue is resolved and you can now add the OCX to the Visual Studio Toolbox and then drop it on your WinForms screen (C# or VB.Net).

Long Term Solution: We may decide to remove the lObjectSafety implementation in the VB UIs (single implement statement) since the VB OCXs are no longer supported being run in Internet Explorer.

  • Oops. Pressed CR too soon:

    VERSION 5.00
    Object = "{0DEA9B46-5CF3-47D8-8E67-95A6D7729E31}#1.0#0"; "AccpacAR2100.ocx"
    Begin VB.Form Form1
    Caption = "Form1"
    ClientHeight = 9840
    ClientLeft = 108
    ClientTop = 432
    ClientWidth = 16080
    LinkTopic = "Form1"
    ScaleHeight = 9840
    ScaleWidth = 16080
    StartUpPosition = 3 'Windows Default
    Begin AccpacAR2100.AccpacAR2100UICtrl AccpacAR2100UICtrl1
    Height = 9636
    Left = 72
    TabIndex = 1
    Top = 72
    Width = 14460
    _ExtentX = 25506
    _ExtentY = 16997
    BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
    Name = "MS Sans Serif"
    Size = 7.8
    Charset = 0
    Weight = 400
    Underline = 0 'False
    Italic = 0 'False
    Strikethrough = 0 'False
    MaskColor = -2147483633
    Begin VB.CommandButton Command1
    Caption = "Apply Modernization"
    Default = -1 'True
    Height = 672
    Left = 14760
    TabIndex = 0
    Top = 96
    Width = 1224
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private modernizer As New AccpacContainerObject

    Private Sub AccpacAR2100UICtrl1_OnPopupOpened(ByVal strPopupName As String, PopupDSs As AccpacAR2100.ACCPACDSControls, PopupCtls As AccpacAR2100.ACCPACControls, strPopupCaption As String, icoPopup As stdole.Picture)
    On Error GoTo ErrorHandler
    mModernizationContainer.ModernizePopup strPopupName, PopupDSs, PopupCtls, strPopupCaption, icoPopup
    Exit Sub
    MsgBox Err.Description
    End Sub

    Private Sub Command1_Click()
    On Error GoTo ErrorHandler
    modernizer.ModernizeVBForm Me
    Exit Sub
    MsgBox Err.Description
    End Sub

    I hope this helps.

  • Hmmm. I believe since you are running it outside of the Sage 300 container, it does not have the logic to "modernize" itself. Here is a code snippet from a VB sample where we added an OCX to a VB6 screen and then invoked methods on the container to tell it to modernize. You would need to do the similar in managed code:

  • Hi John,   

    When I use the OCX on a form using C# or VB.Net, the layout is not the same as the original (Ex. the grid header, the file menu, the field on the ocx) (See below). 1- Is there a way I can force the ocx to use the new layout?

    2- How can I use the File Menu?

    Thank you!