Results 1 to 1 of 1

Excel VBA-JSON Example

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-24-2014
    MS-Off Ver
    Microsoft Office 2013
    Posts
    113

    Excel VBA-JSON Example

    I am trying to use the VBA-JSON add-in to import some JSON data from an API into a sheet. I've been able to download the module to do this but I'm unsure how to approach it. I am trying to run one of the samples provided but I keep getting an error. The module I imported is found here.

    This is what I try running
    Sub importjsondata()
    Dim Json As Object
    
    Set Json = JsonConverter.ParseJson("{""a"":123,""b"":[1,2,3,4],""c"":{""d"":456}}")
    
    End Sub

    It errors out on on a private function included in the downloaded module. "Compile error: User-defined type not defined"
    Private Function json_ParseObject(json_String As String, ByRef json_Index As Long) As Dictionary
    Could anyone help me fix this? If so, my next step would be to import the parsed data into a worksheet and I assume I would just treat the JSON object like a dictionary and loop through it.

    EDIT: I found out that I just needed to add a reference to "Microsoft Scripting Runtime" and it stopped the error. Could anyone help me figure out how to loop through the dictionary and write it to a worksheet?
    Last edited by manofcheese; 03-28-2016 at 12:00 PM. Reason: New Info

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Importing JSON/XML into Excel from Web service
    By starfish_001 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2016, 08:20 AM
  2. Json to Excel Conversion
    By shrikant_chandurkar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-19-2015, 03:50 AM
  3. API Json to Excel Macro
    By ermengard in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2014, 05:33 AM
  4. Json file from URL to Excel
    By KK33317 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2014, 10:50 AM
  5. Json file from URL to Excel
    By KK33317 in forum Tips and Tutorials
    Replies: 0
    Last Post: 03-13-2014, 07:39 AM
  6. Import JSON Api to Excel
    By hockeyadc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2014, 01:42 PM
  7. Import JSON in Excel by macro
    By bmmerkx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2013, 09:39 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1