vasuppolitics.blogg.se

Google maps api vba
Google maps api vba









Private Function GetJSONObject(ByVal obj As Object, ByVal sKey As String) As Object Private Function GetJSONPrimitive(ByVal obj As Object, ByVal sKey As String, Optional vDefaultValue As Variant) As Variant Set DecodeJsonString = oScriptEngine.Eval("(" + JsonString + ")")Ĭall oScriptEngine.Run("overrideToString", DecodeJsonString) '* this gives JSON rendering instead of "" Private Function DecodeJsonString(ByVal JsonString As String) As Object

google maps api vba

GetJavaScriptLibrary = xHTTPRequest.responseText Private Function GetJavaScriptLibrary(ByVal sURL As String) As String Will entertain suggestions, looking for best practice because in future looking to build J2EE application with REST interfaces that will use JSON and was planning to use Excel VBA as a debugging front end tool. I also found some debugging sugar to stringify variables. Further I found some hasOwnProperty() method which allows defensive programming, so call this in cases where one thinks a member is missing. that which comes out of ScriptControl's Eval method.ĬallByName can be used to get a member value it can be used to query length of an array it can be used to access elements of an array all with any javascript.

google maps api vba

The key finding here is the use of VBA's CallByName function which can be used to query a JScriptTypeInfo Object Instance i.e.

GOOGLE MAPS API VBA CODE

They all seem to take a mini-script approach of adding some javascript code to the script engine and calling it is cool but perhaps used too widely when there is a native solution available. I have also seen a number of stack overflow questions which advocate third party libraries and I was puzzled by this. To parse the JSON, I use the ScriptControl. I didn t quite understand what he wanted at first and so actually there is some superfluous code here but I thought it would be useful to park my findings as to good practices for parsing JSON. Some guy wanted to query Google Maps receive some JSON and then for each result found within that JSON do another query.

google maps api vba

Some code that I wrote and broke into 5 separate questions on stack overflow.









Google maps api vba