Closed Amertz08 closed 5 years ago
Currently I believe this issue is caused by that array on "headers". Is this the VBA provided the correct way to structure the request?
Not running on a Mac (at the moment), but you can help Tim out if you had the actual error message and tried to debug the root cause (object is Nothing, value is null, etc, etc). I'd imagine if you could illustrate the cause of the error message, you could illuminate the solution to the problem.
That is the only error message I've seen. PrepareCurlRequest fails here and then I traced via Debug.Print
to where the underlying failure is to it setting the user-agent key.
I did attempt to just convert the request body to JSON (via ConvertToJson) prior to assigning it to the body and that also failed. Gave me a "Object does not support this property or method" and then showed me this line.
Yeah so finally figured it out for the most part. I'm not sure why but assigning a value to a dictionary via Dic("A") = "val"
does not work in WebHelpers.bas
Dictionary 1.4.1
I was able to get past this by using .Add "key", "value"
syntax.
I was able to verify that this is also an issue in Windows in Office 365. The following lines throw Object does not support this property or method.
Public Function CreateKeyValue(Key As String, Value As Variant) As Dictionary
Dim web_KeyValue As New Dictionary
web_KeyValue("Key") = Key ' error here
web_KeyValue("Value") = Value
Set CreateKeyValue = web_KeyValue
End Function
I realized I had not imported my .cls
files correctly. Purged my project and imported them again. This resolved it.
Getting this error on an API request.
This is the code being invoked generalized
I've went thought the code flow using
Debug.Print
to determine on what calls it is breaking. It appears to be emanating from here. The final failure point appears to be here where it setsKey
to"User-Agent"
.For the life of me I can't tell why this would be causing any issues but it is. The JSON struct should look as so
Max OSX: 10.14.3 Excel: 16.23 VBA-Web: 4.1.6