#author("2020-06-05T23:18:46+09:00","ldap:pandora"," pandora") #author("2020-06-07T00:42:34+09:00","ldap:pandora"," pandora") * ''VBA'' [#vc4f4c32] #contents 参照[https://ja.wikipedia.org/wiki/Visual_Basic_for_Applications] * 基本文法 [#h562a551] - 宣言 #highlighter(perl,number){{ Function main() Dim i As Intger '整数型の定義 Dim moji As String '文字型の定義 Dim d As Double '小数型の定義 Dim day As Date '日付型の定義 Dim array() As String '配列の定義 Dim any As Variant '全ての型 main = i '返却値 } }} - 計算符号 |>|CENTER:100|c |>|計算符号|h |+|加算| |-|減算| |*|乗算| |^|累乗| |/|除算| |\|商| |Mod|余り| - 論理式 |>|CENTER:200|c |>|論理式|h |<|未満| |<=|以下| |>|超過| |>=|以上| |=|等しい| |<>|等しくない| |And|AND| |Or|OR| - if文 #highlighter(perl,number){{ Dim key As Integer key = 1 If Key = 2 Then '真 Else '疑 End if }} - for文 #highlighter(perl,number){{ For i = 1 To 10 Step 1 ' 10回ループ Next i }} * 特殊構文 [#p3a0e375] - 拡張for文 #highlighter(perl,number){{ Dim array() As String ReDim Member(3) '配列要素数再定義 array(1) = "apple" array(2) = "banana" array(3) = "orange" For Each tmp In array '配列の要素分ループ Next }} - ループ文制御 #highlighter(perl,number){{ Dim i As Intger i = 1 Do while $i > 0 '無限ループ i = i + 1 if i > 3 Then GoTo label01 ' ①にジャンプ End if i = i + 1 :label01 ' ① Loop }} * Samples [#p416db79] * 関連 [#p416db79] #ls2