Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Microsoft Word VBA code for Comment to JSON
Sub ListComments()
Dim x As Document
Set doc = Word.ActiveDocument
For k = 1 To doc.Comments.Count
Dim co As Comment
Set co = doc.Comments(k)
co.Range.Select
t = Selection.Text
Next
Dim jsonItems As New Collection
Dim jsonDictionary As Dictionary
Dim jsonFileObject As FileSystemObject
Dim jsonFileExport As TextStream
set jsonDictionary = new
jsonItems = "ciao"
Set jsonFileExport = jsonFileObject.CreateTextFile("/tmp/out.json", True)
jsonFileExport.WriteLine (JsonConverter.ConvertToJson(jsonItems, Whitespace:=3))
End Sub
rem http://excelerator.solutions/2017/08/24/convert-excel-to-json-using-vba/
rem https://github.com/VBA-tools/VBA-JSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.