0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VBA Collection型 引数は省略できません 449

Last updated at Posted at 2025-08-28

##VBA Collection型 引数は省略できません 449

某プロジェクト管理ツールのサイトからjsonデータをひっぱってきたときにこのエラーでハマりました。
原因はCollection型の1要素が更にVariant型になっていたことです。
ExcelのVBEだとデバッグ時に変数の中身がメモリ領域としてみれないので解明に時間を要してしまいました。
※ググっても解決方法が全然でてこないのでここに書くことにしました

Collection型などの動的配列型がネスト構造になっている場合はその中の値をピンポイントで取得するのがかなり面倒です。

①まずはCollection型に登録されている要素の型をTyoeName関数で調べる
②型がわかったらFor Each等でさらに要素を分解
③さらにその先が配列型になっていたら①②の繰り返し

これで目的の値までたどり着くことができます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?