私が使用する準備ができて解決策を見つけたし、どれも見つからなかったことを試みました。 私は何かを使用可能にしました。純粋なYAMLインタプリタではなく、key:valueデータを解析できます。 YAMLファイルの
機能VBA ParseYAML
Sub ParseYAML()
Dim myFile As String, text As String, textline As String
' open YAML file
myFile = Application.GetOpenFilename()
' verify if a file were open
If Not myFile = "Falsch" Then
Open myFile For Input As #1
Dim dataArray
Dim c As Collection
Set c = New Collection
Line = 0
Do Until EOF(1)
Line Input #1, textline
oneline = Replace(textline, " ", "")
dataArray = Split(oneline, ":", 2)
sizeArray = UBound(dataArray, 1) - LBound(dataArray, 1) + 1
' Verification Empty Lines and Split don't occur
If Not textline = "" And Not sizeArray = 0 Then
Data = dataArray(1)
Key = dataArray(0)
' test if line don't start with -
If InStr(1, Key, "-") = 0 Then
c.Add Data, Key
End If
' just for debug
Line = Line + 1
'text = text & textline
End If
Loop
Close #1
Range("D6").Value = c.Item("key1")
Range("D7").Value = c.Item("key2")
Range("C18").Value = c.Item("key3")
Set c = Nothing
End If
End Sub
例
- セクション1:
キー1:DATA1
KEY2:DATA2
- section2の:
KEY3:データ3
おそらくそうではありません。あなたが32bitであれば、scriptcontrolを使って、JS-YAMLライブラリを活用しようとすることができます。より堅牢で柔軟な方法は、C#コムdllになります。しかし、とにかく、準備ができているものは何もないので、あなた自身でそれを書く必要があります。 – cyboashu
もしそうなら、どのようにしてパーサーを書くことができますか?パーサーを書くためにどのツールを使うべきですか?どの言語を使って作成すればいいですか?また、Excel vbaでどのようにインポートできますか? – Jeevan
私はYAMLのために何も持っていませんが、このリンクを参照してください。http://ashuvba.blogspot.com/2014/09/json-parser-in-vba-browsing-through-net.html?m=1スクリプトコントロールを使用してjsonを作成しますVba内のパーサー – cyboashu