'クラスモジュールKakunouClassを作成 Public Name As String Public Father As String Public Mother As String '自分自身を返す Public Property Get Self() As KakunouClass Set Self = Me End Property
'標準モジュール等 Dim kakunou_dic, buf As String Dim kc As KakunouClass '自作のデータ格納クラス Set kakunou_dic = CreateObject("Scripting.Dictionary") buf = "テスト" If Not Kakunou_dic.Exists(buf) Then With New KakunouClass .Name = buf .Father = "父" kakunou_dic.Add buf, .Self End With End If '配列からクラスを取得(削除)して追加 If kakunou_dic.Exists(buf) Then Set kc = kakunou_dic.Item(buf) 'Debug.Print "kc.Father = " & kc.Father '確認 kc.Mother = "母" kakunou_dic.Remove buf Kakunou_dic.Add buf, kc End If
以上。