このエラーが出るのですが、どう対処すべきが教えてください。
データ テーブルを Excel に書き込み: Object reference not set to an instance of an object.
このエラーが出るのですが、どう対処すべきが教えてください。
データ テーブルを Excel に書き込み: Object reference not set to an instance of an object.
Hi @tttttt
Check all the variables has initialiazed or not.
If Yes,Check all are holding the values and scope of the variables
Hope it helps!!
If the DataTable might be empty (no rows), check the row count before attempting to write it to Excel.
if:Dt IsNot Nothing AndAlso Dt.Rows.Count>0
Then
else
Hi @tttttt
You data table is empty that’s the reason you are getting that error. Check whether there is any data in the data table by debugging the flow.
Or share wat are you exactly trying to do, we will be able to help.
Regards
一般的にこのエラーは変数に初期値もしくは値が設定されてないときに出るエラーです。
ご提案の事象ですと、Datatableの何かの値が設定されていないのでは?
ご回答ありがとうございます。
おっしゃる通りデバッグしてみたところデータがnullでした。
しかし、初期値を設計するとなるとDataTable型の場合、何を設定するのがいっぱんてきなのでしょうか。
また、次はこのようなエラーが出てきたのですが、対処法等ありますでしょうか。
引数 ‘Range’: BC30512: Option Strict On では ‘DataTable’ から ‘IReadRangeRef’ への暗黙的な変換は許可されていません。 選択した値がプロパティの型に対応していません。
もしあなたが初心者の場合、DataTableはExcel同様、表形式でデータを管理するため、(範囲を読み込み)Read Rangeアクティビティを使ってExcel sheetをRead RangeしてDataTable作成するのが簡単です。
初心者でない場合は、Build DataTableアクティビティを使って手入力でDataTableを作成する方法もあります。