Excel Add-In for CockroachDB

Build 22.0.8479

UI エレメントの呼び出し

CData.ExcelAddIn.ExcelAddInModule クラスを使用して、CData リボンで使用可能な機能をコード内で呼び出します。

モジュールを初期化

以下のコードを使用してモジュールを初期化してください。モジュールは、ワークシートにリンクされている接続を暗黙的に使用します。リボンの[取得元:CockroachDB]をクリックしてデータをプルすると、ワークシートがリンクされます。

リンクされた接続を設定するには、接続の管理 を参照してください。

Dim addin As COMAddIn
Dim adxModule As Object
Set addin = Application.COMAddIns.Item("CData.ExcelAddIn.ExcelAddInModule")
Set adxModule = addin.Object

データのリフレッシュ

次のメソッドを使用して、現在のデータでワークシートをリフレッシュするか、ローカルの変更を元に戻します。

Function RefreshAll()
ワークブック内のすべてのワークシートをリフレッシュします。この処理はローカルの変更を上書きするため、ユーザーに許容を促します。
adxModule.RefreshAll

Function Refresh()
選択されたワークシートをリフレッシュします。この処理はローカルの変更を上書きするため、ユーザーに許容を促します。
adxModule.Refresh

Function RevertRows() As String()
選択された行を元に戻します。[SUCCESS|ERROR][:Error Message] の形式で、成功または失敗値から成る配列が返されます。
Dim arr() As Long
Dim ret() as String
ret = adxModule.RevertRows()

Function Revert(Long() rowIndexes) As String()
指定した行インデックスの行を元に戻します。[SUCCESS|ERROR][:Error Message] の形式で、成功または失敗値から成る配列が返されます。
Dim arr() As Long 
Dim ret() as String
arr = adxModule.GetUpdatedRows()
ret = adxModule.Revert(arr)

Update

次のメソッドを使用して、ワークシートまたは行レベルで更新します。

Function UpdateAll()
ワークシート内の変更されたすべての行をデータソースに保存します。
adxModule.UpdateAll

Function UpdateRows() As String()
選択された行をデータソースに保存します。[SUCCESS|ERROR][:Error Message] の形式で、行ごとに成功または失敗値から成る文字列配列が返されます。
Dim ret() As String
arr = adxModule.UpdateRows()

Function Update(Long() rowIndexes) As String()
指定した行インデックスの行を保存します。[SUCCESS|ERROR][:Error Message] の形式で、行ごとに成功または失敗値から成る文字列配列が返されます。
Dim arr() As Long
Dim ret() As String
arr = adxModule.GetUpdatedRows()
ret = adxModule.Update(arr)

Function GetUpdatedRows() As Long()
シート内の変更された行のインデックスをlong 型の配列として返します。
Dim arr() As Long
arr = adxModule.GetUpdatedRows()

ポップアップメッセージの表示

showPopups というboolean 型のパラメータがあり、adxModule の以下の関数で利用できます。

  • adxModule.Update(indexes, [showPopups])
  • adxModule.UpdateAll([showPopups])
  • adxModule.VBAFunction([OtherParameters,...][showPopups])

showPopups がTrue に設定されている場合、確定、エラー、警告、情報の各ポップアップメッセージがユーザーに通知されます。このパラメータはデフォルトではfalse です。

Insert

次のメソッドを使用して、選択された行または指定した行インデックスの行を挿入します。

Function InsertRows() As String()
選択された行を挿入します。[SUCCESS|ERROR][:Error Message] の形式で、行ごとに成功または失敗値から成る文字列配列が返されます。
Dim ret() As String
ret = adxModule.InsertRows()

Function Insert(Long() rowIndexes) As String()
指定した行インデックスの行を挿入します。[SUCCESS|ERROR][:Error Message] の形式で、行ごとに成功または失敗値から成る文字列配列が返されます。
Dim arr() As Long 
Dim ret() as String
arr = adxModule.GetInsertedRows()
ret = adxModule.Insert(arr)

Function GetInsertedRows() As Long()
ワークシートに追加された行のインデックスをlong 型の配列として返します。
Dim arr() As Long
arr = adxModule.GetInsertedRows() 

Delete

次のメソッドを使用して、選択された行または行インデックスで指定した行を削除します。

Function DeleteRows() As String()
選択された行を削除します。[SUCCESS|ERROR][:Error Message] の形式で、行ごとに成功または失敗値から成る文字列配列が返されます。
Dim ret() As String
ret = adxModule.DeleteRows()

Function Delete(Long() rowIndexes) As String()

指定した行インデックスの行を削除します。[SUCCESS|ERROR][:Error Message] の形式で、行ごとに成功または失敗値から成る文字列配列が返されます。

次の例では、最初の3行(最初のカラムヘッダー行の後)が削除されます。

Dim arr() As Variant
Dim arr(3) As Long
arr(1) = 2
arr(2) = 3
arr(3) = 4
ret = adxModule.Delete(arr)

UpSert

Use the following methods to update/insert at the worksheet or row level.

Function UpSertAll()
Saves all changed rows in the worksheet to the data source.
adxModule.UpSertAll

Function UpSertRows() As String()
Saves the selected rows to the data source. Returns a string array of success or failure values for each row, in the form [SUCCESS|ERROR][:Error Message].
Dim ret() As String
arr = adxModule.UpSertRows()

Function UpSert(Long() rowIndexes) As String()
Saves the rows at the row indexes you specify. Returns a string array of success or failure values for each row, in the form [SUCCESS|ERROR][:Error Message].
Dim arr() As Long
Dim ret() As String
arr = adxModule.GetUpSertedRows()
ret = adxModule.UpSert(arr)

Function GetUpSertedRows() As Long()
Returns the indexes of the modified rows in the sheet, as an array of longs.
Dim arr() As Long
arr = adxModule.GetUpSertedRows()

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8479