Hi! I tried to make a json file using VBA, but seems that certain characters are missing.
- the json file looks okay (every character is displayer when I open it)
- but when I try to read the json file from VSC (text editor which read snippets from the json file) then certain characters are missing (In Hungarian there is á,é,í) so i think that somehow the encoding is not right
Could somebody help me out how could I add specific encoding to my code? Thank you very much, I am really stucked with this one
Have a nice day!
- the json file looks okay (every character is displayer when I open it)
- but when I try to read the json file from VSC (text editor which read snippets from the json file) then certain characters are missing (In Hungarian there is á,é,í) so i think that somehow the encoding is not right
Could somebody help me out how could I add specific encoding to my code? Thank you very much, I am really stucked with this one
Have a nice day!
VBA Code:
'' Output the JSON string to a new document
'Documents.Add.Content.Text = strJSON
' Objects required to backup and open the JSON file
Dim fs As Scripting.FileSystemObject, ts As Scripting.TextStream
Dim strDocumentName As String, strJSONFilePath As String, strBackupOfJSONFilePath As String
74 Set fs = CreateObject("Scripting.FileSystemObject")
' Construct the corresponding JSON file path
75 strDocumentName = d.Name
76 strJSONFilePath = "C:\Users\" & Environ$("Username") & "\AppData\Roaming\Code\User\snippets\" & _
Left(strDocumentName, InStrRev(strDocumentName, ".")) & "json"
' Construct the corresponding backup JSON file path
77 strBackupOfJSONFilePath = "C:\Users\" & Environ$("Username") & "\AppData\Roaming\Code\User\snippets\BACKUP\" & _
"(" & Replace(Now(), ":", ".") & ")" & Left(strDocumentName, InStrRev(strDocumentName, ".")) & "json"
' Backup the JSON file
78 If fs.FileExists(strJSONFilePath) Then
79 fs.MoveFile strJSONFilePath, strBackupOfJSONFilePath
80 End If
' Create the new JSON file
81 fs.CreateTextFile(strJSONFilePath, True, False).Write strJSON
82 MsgBox "Done", vbInformation, "MSWordTableToJSON"
83 Exit Sub