VBA는 Excel를 다루는 사용자에게 가장 유용하고 접근이 쉬운 개발언어로, 이를 이용하여 MIDAS-Civil API를 사용하는 방법을 알아보도록 하겠습니다.
...
n | Example |
---|---|
item 더하기 (Key가 존재하면 안됩니다.) | dict.add Key, Value (e.g. dict.add “Apples”, 50) |
Item 수정하기 (만약, Key가 존재하지 않으면, 자동으로 더해줍니다.) | dict(Key) = Value (e.g. dict(“Oranges”) = 60) |
Key 값으로 Value 가져오기 | Value= dict(Key) (e.g. applecount = dict(“Apples”) |
Key값이 존재하는지 확인하기 (return as boolean) | dict.Exists(Key) (e.g. if dict.Exists(“Apples”) then) |
Item 지우기 | dict.Remove Key e.g. dict.Remove “Apples” |
모든 Item 지우기 | dict.RemoveAll |
Items 개수 가져오기 | dict.Count |
모든 Item을 확인하기 (for each loop) | Dim key As Variant For Each key In dict.Keys Debug.Print key, dict(key) Next key |
모든 Item을 확인하기 (for loop - early binding only) | Dim i As Long For i = 0 to dict.Count - 1 Debug.Print dict.Keys(i), dict.Items(i) Next i |
모든 Item을 확인하기 (for loop - early and late binding only) | Dim i As Long For i = 0 to dict.Count -1 Debug.Print dict.Keys()(i), dict.Items()(i) Next i |
Key 에서 대소문자를 구분하기 (Dictionary 는 비어져 있어야 합니다.) defalut입니다. | dict.CompareMode = vbBinaryCompare |
Key 에서 대소문자를 구분하지 않기 (Dictionary 는 비어져 있어야 합니다.) | dict.CompareMode = vbTextCompare |
모든 Key을 배열로 반환하기 | Dim KeyValues as Variant KeyValues = dict.Keys |
모든 Item을 배열로 반환하기 | Dim ItemValuesas Variant ItemValues= dict.Items |
...