つらつら Excel VBA

私の備忘録です。

Excel VBA 構造体配列

'構造体の宣言は標準モジュールのTopで行う。(Option~のすぐ下)

Option Explicit

Public Type FileInfo '構造体の宣言
    no As Integer
    name As String
    title As String
End Type

Public FileInfoList(10) As FileInfo '構造体配列の宣言

 

'こんな感じ(動作未検証)

Dim fi As FileInfo
fi.no = 1
fi.name = "Name"
fi.title = "Title"
FileInfoList(0) = fi