¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: CUSIP/ISIN in ActiveX API using VBA in Excel


 

¿ªÔÆÌåÓý

The problem here is that the secIdList property is actually a generic object of type ComList<ComTagValue, TagValue>, and generic objects cannot be mapped into COM objects (which is why the Excel Object Browser shows it simply as being of type Object).

?

So you can't access any of the members of this type. However all is not lost because the ComList<ComTagValue, TagValue>, ?type implements the IList<ComWrapper<T>> interface, which should enable the members of the list to be iterated over using For Each, something like this:

?

Dim s As String

Dim tv As ComTagValue

For Each tv In ContractDetails.secIdList

??? s = s & tv.tag & ": " & tv.value & ";"

Next

?

MsgBox s, , "SecIdList"

?

I haven't been able to actually try this because at the moment I can't seem to make the damn ActiveX Excel workbook work at all (I rebuilt the ActiveX control from the latest files in the Github repository, and at the moment neither the C# API nor the ActiveX API will connect successfully ¨C they just hang).

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of praditik@...
Sent: 18 February 2021 14:17
To: [email protected]
Subject: [TWS API] CUSIP/ISIN in ActiveX API using VBA in Excel

?

Hello,

I have been trying to get ISIN and CUSIP from ActiveX API and failed everytime. I am using reqContractDetails and trying to read secIdList.?

I have successfully received the required info while using python API (So my account has necessary subscription). However, how exactly do I read secIdList in VBA while using ActiveX client?

I tried to assign the secIdList to TwsLib.ComTagValueList and also checking if secIdList is Null. Everytime I receive error in bold statements.?

Function writeContractName(contractDetails As TWSLib.IContractDetails, reqid As Long)

? ? Dim rowNum As Long

? ??

? ? contractName = contractDetails.longName

? ??

? ? Debug.Print IsNull(contractDetails.secIdList)

? ??

? ??

? ? If IsNull(contractDetails.secIdList) = False Then

? ? ? ? Debug.Print contractDetails.secIdList(0).tag

? ? End If
End Function



I tried looking everywhere and could not arrive at a satisfactory explanation for this issue!

Thanks and Regards,
Pratik

Join [email protected] to automatically receive all group messages.