Author |
Topic: COM sample code not working GF API (2 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
ASykes4318 Posts: 18 Joined: |
The following is a sample code from the Excel COM spreadsheet provided by GF. The Set bc not working, what should be done differently??
bc.Symbol is showing a runtime error Is there some updated sample code that works?? Private Sub LookupRequest(ByVal Name As String) If Len(Name) > 0 Then api.contracts.lookup.BySymbol Name Dim builder As SymbolLookupRequestBuilder Set builder = New SymbolLookupRequestBuilder Dim bc As BaseContract Set bc = api.contracts.Base.Get_3(Name) If Not (bc Is Nothing) Then builder.WithBaseSymbol bc.Symbol, TextSearchMode_StartsWith Else builder.WithSymbol Name, TextSearchMode_StartsWith End If builder.WithResultCount 1 api.contracts.lookup.ByCriteria builder.Build End If End Sub Anthony Sykes
|
||||
JSmith5611 Posts: 187 Joined: |
Most of that code is commented out in the excel example. probably was a leftover from coverting from old api to the new one.
Here's a version of that function that does work: Private Sub LookupRequest(ByVal Name As String) The Mid() call stripping the last 3 characters off is to get, for example, 'ES' from 'ESZ20', as that is the base contract name. Jason Smith Edited by JSmith5611 on Oct 28, 2020 02:19 PM |
||||