SaladLab / ExcelJsonTable

Excel Add-In for Importing and Exporting Json Table
MIT License
25 stars 11 forks source link

Call to the JsonTable routine to import the xxxx.json file generated and saved from VBA #3

Open orooro opened 7 months ago

orooro commented 7 months ago

hello, first of all congratulations for the work.

I have been testing the plug-in and it works perfect.

What I would like to know is if I can run from a macro the import functionality without the ribbon buttons.

The vba code would be this

Sub sbGetHTTPToFile(strURL As String) 'Get data from a URL and store to "JSON.txt" in the same 'directory as the excel spreadsheet.

Dim xmlHttp As Object
Dim strReturn As String

'Open URL and get JSON data
Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
xmlHttp.Open "GET", strURL
xmlHttp.setRequestHeader "Content-Type", "text/xml"
xmlHttp.setRequestHeader "x-auth-token", apiKey
xmlHttp.send

'Save the response to a string
strReturn = xmlHttp.responseText

'save JSON text to file
fnExportTextFile ActiveWorkbook.Path & "\JSON.txt", strReturn

*** call to the JsonTable routine to import the xxxx.json file generated and saved from VBA


End Sub