2

I have a number of local JSON files which I am trying to open as a string using VBA in order to extract specific information from them into Excel.

I have seen a similar exercise work when the files are accessed by HTTP (using New.WinHTTP.WinHTTPRequest), however when I've tried to adapt this using a FILE:/// prefix it won't work.

Is there a different Excel method I can use to access the string content of the JSON file?

Cheers

Chris

1 Answer 1

3

Reading from disk is not really something you would adapt code that reads from a url to do.

You can load it into memory with;

dim hf As integer: hf = freefile
dim data as string

open "c:\bla\bla.bla" for input as #hf
    data = input$(LOF(hf), #hf)
close #hf

debug.? data

There are many results for JSON parsing in vba.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.