Forum Discussion

Phil_Jeffrey_KC's avatar
Phil_Jeffrey_KC
Experienced User
5 months ago

Unsupported browser error

As others have discovered, apps that use the IE browser control, such as VB or VBA apps, no longer work.  There is an Edge Browser control available for VB/VBA apps.  I'm currently trying to get the ...
  • Phil_Jeffrey_KC's avatar
    5 months ago

    Just thought I would provide an update on this topic, for partners with Microsoft Access VBA apps that used the WebBrowser (IE) control to handle MYOB's authentication process.

     

    Microsoft has created an "Edge Browser Control" specifically for Access, but this is incompatible with MYOB's authentication process.  Basically you need to provide the control with a pre-defined list of trusted URLs that it can redirect to.  But because the MYOB authentication process returns a different auth code in the URL every time, it is impossible to predict what those URLs will be.

     

    The solution I found was a company who created an ActiveX "wrapper" around the WebView2 component, to make it compatible with Microsoft Access.  The component is located here: https://antview.dev/.  I've done some testing with the 30 day trial, and it works.  The full version is 300 euros (around A$500).

     

    Here is the VBA code for my Access MYOBLogin form, if anyone is interested.  "EdgeBrowser2" is the name of the AntView browser control.

     

    Option Compare Database
    
    Private Sub Form_Load()
    
    Dim strURL As String
    
        MYOB_KEY = GetMYOBKey()
        
        strURL = "https://secure.myob.com/oauth2/account/authorize?client_id=" & MYOB_KEY & "&redirect_uri=http:%2F%2Fdesktop&response_type=code&scope=CompanyFile"
        
        ' the below command is necessary so we can use the OnNavigationCompletedHex event,
        ' as Access doesn't support the LongLong parameter in the OnNavigationCompleted event
        Me.EdgeBrowser2.EventsUseHexadecimal = True
        
        Me.EdgeBrowser2.Navigate strURL
        
    End Sub
    
    
    Private Sub EdgeBrowser2_OnNavigationCompletedHex(ByVal IsSuccess As Boolean, ByVal WebErrorStatus As TxWebErrorStatus, ByVal NavigationIdHex As String)
    
        Dim b As String
        b = Me.EdgeBrowser2.Source
        
        If b Like "*code=*" Then
            MYOB_CODE = Right(b, Len(b) - 21)  ' remove "http://desktop/?code="
            MYOB_CODE = Left(MYOB_CODE, InStr(MYOB_CODE, "&scope=") - 1)   ' remove everything from "&scope=" to the end of the string
            Debug.Print MYOB_CODE
            UpdateMYOBCode MYOB_CODE   ' sub to save the auth code to a table, so it can be used to get the token
            DoCmd.Close acForm, "MYOBLogin"  ' close the login form
        End If
        
    End Sub