0

I am trying to import data from an API and am running into trouble when I try to pull the data. The reason being that I am running Excel 16' on Mac os and ActiveX is not optimized for Mac and thus cannot create the necessary object. Unfortunately, I am not adept enough in VBA to craft my own solution. How can I work around this issue? I am utilizing Tim Hall's synthetic scripting library to use JSon, which works perfectly.

The debug stops at the set myrequest line below:

'send web request for api data
u = "https://financialmodelingprep.com/api/v3/financials/income-statement/" & ticker & " "

Set myrequest = CreateObject("Winhttp.WinHttopRequest.5.1")

myrequest.Open "Get", u

myrequest.Send 

The exact error message I'm receiving is "ActiveX component cannot create object". Thanks in advance for any help!

I have tried using John Stephens/Scott Dudley's solution to this issue (How do I issue an HTTP GET from Excel VBA for Mac) but I am getting a value error in excel when I call the function httpGet.

  • Try [VBA-Web](https://github.com/VBA-tools/VBA-Web), uses curl as no winhttprequest on mac. – ComputerVersteher Jul 02 '19 at 06:31
  • That is a good suggestion, which I have tried. However, I have had a few issues. For one, there is a bug on importing the package into an existing file in Excel 16. Second, even after importing the package manually, I wasn't able to write a useful GetJSON function to pull from the API - I am not super familiar with the syntax. I will try to figure it out but any guidance is helpful. – Sloan Madoff Jul 03 '19 at 04:30
  • What bug on import? I can't see an issue in projects issue tracker, maybe create one. No need for writting an GetJSON function as the WebClient object has a built in method, that creates a WebResponse with parsed Json in Data property, can be accesed by a dictionary, see [GetJSON Example](https://github.com/VBA-tools/VBA-Web#getjson-example). – ComputerVersteher Jul 03 '19 at 05:15
  • Here is the issue I'm [referencing](https://github.com/VBA-tools/VBA-Web/issues/295) . I meant I am having trouble retrofitting the example function to suit my purpose, which is to pull a long financial statement from the API. – Sloan Madoff Jul 04 '19 at 17:20
  • Provide a sample response. and wanted data The magic happens in`ProcessDirections`in the example. By assigning the`Response`to a Dictionary, you can access the nodes pretty easy. – ComputerVersteher Jul 04 '19 at 17:47

0 Answers0