VBA: Object variable or with block variable not set

Hello,

Just got a new computer and trying to get the real time API to work on excel. I followed the installation steps and tried the simplest code from tutorial but it yields me an error "Object variable or with block variable not set".

Below is my code:

Dim WithEvents myRTGet As AdfinXRtLib.AdxRtLi
Sub myRtGetExample()
  Set myRTGet = CreateAdxRtList()
  
  With myRTGet
      .Source = "IDN"
      .RegisterItems "EUR=", "BID"
      .StartUpdates RT_MODE_IMAGE
  End With
End Sub

' Returns the initial image for the instrument. NOTE - .StartUpdates RT_MODE_IMAGE'
Private Sub myRtGet_OnImage(ByVal DataStatus As AdfinXRtLib.RT_DataStatus)
  ' The value for the specific instrument, specific field, only one in this case.'
  Debug.Print myRTGet.Value("EUR=", "BID")
End Sub

Any idea what is happening ?

Thanks for the help!

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    Check the bitness of Excel. Eikon COM APIs are only available as 32-bit libraries, which can only be used in 32-bit Excel. If you have 64-bit Excel you cannot use Eikon COM APIs in Excel VBA.

Answers