I checked with the Fed people and they said no changes at their end that would cause this, so I guess we're back to missing references. I added in a couple that looked promising to see if they fixed it, but no luck. I'm posting that section of code to see if anyone here has any ideas. What happens is that I get the "User-defined object not defined" error on compile, even before any code actually starts running; the error comes the first time I try to DIM an object in this FRED section of code. Presumably if I marked that line as a remark it would do the same thing at the next DIM statement. (FWIW, I got that error in a completely different part of the project regarding an Excel object, but adding in the relevant Excel library fixed that one.)
Here's the code, the Dim statement that throws the first compile error is in a box of #######'s. Any and all thoughts welcome. Bear in mind this has been working fine for several years now, as recently as July.
Code:
'FRED Connection Information'
Dim start_date As String
API_Key = "6a1847ca64fdbc86bfe5385a80359a35"
start_date = Format(mostRecentUpdate, "YYYY-MM-DD")
API_Request_String = "https://api.stlouisfed.org/fred/series/observations?series_id=DTB3&observation_start=" & start_date & "&api_key=" & API_Key
'Connect to FRED API'
'########################################
Dim Req As New XMLHTTP '################
'########################################
Req.Open "GET", API_Request_String, False
Req.send
Dim Resp As New DOMDocument
Resp.LoadXML Req.responseText
Dim dailyData As IXMLDOMNode
Dim stringSQL As String
Dim rCnt As Integer
'Update MMTC DB from FRED starting at recent date'
For Each dailyData In Resp.getElementsByTagName("observation")
tBillDate = dailyData.Attributes.getNamedItem("date").Text
tBillValue = dailyData.Attributes.getNamedItem("value").Text
If IsNumeric(tBillValue) <> True Then
tBillValue = 999
dailyTBillValue = 999
Else
'Calculate Daily T-Bill Value; Divide by 100 to convert to decimal'
'Divide by 365 to convert to daily return'
tBillValue = tBillValue / 100
dailyTBillValue = tBillValue / 365
End If
tBillDate = Format(tBillDate, "MM/DD/YYYY")
If tBillDate > mostRecentUpdate Then
stringSQL = "INSERT INTO TBills([Date],[Value],[Daily T-Bill Value])"
stringSQL = stringSQL & "VALUES (#" & tBillDate & "#," & tBillValue & "," & dailyTBillValue & ");"
SysFunctions.insert (stringSQL)
End If
Next dailyData
'Calculates values not available in FRED'
Call Calc_Missing_Values(mostRecentUpdate)