When the Board Office Add-in are installed, it is possible to use the following function in Excel and Word macros.
void ShowConnectDialog();
void ShowSelectDialog();
void Select(string dbname, string Coordinates, object propertyContainer);
bool Connect(string host, int port, string user, string password, bool useSSL, bool useWinEncryption);
bool Connect(string host, int port, bool useSSL, bool useWinEncryption);
void Disconnect();
void Refresh();
void Refresh();
void SetSaveUndoMode(bool value);
void SaveDataOnServer();
bool IsConnected();
string[,] GetElements(string database, string entityName);
string[,] GetElementsCodes(string database, string entityName);
string[,] GetElementsCodesAndDescriptions(string database, string entityName);
object[,] ExecuteScript(string script);
Note:
To view a script open the client and go to the "Board Options" window, enable the option
Sub DoConnect()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
If automationObject.Connect("Local Engine", 0, Nothing, Nothing, False, True) Then
MsgBox "Connected"
Else
MsgBox "Not Connected"
End If
End Sub
Sub IsConnected()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
If automationObject.IsConnected Then
MsgBox "Connected"
Else
MsgBox "Not Connected"
End If
End Sub
Sub DoSelect()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
automationObject.ShowSelectDialog
End Sub
Sub DoSelectScript()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
automationObject.Select "Delta", "Year=2005; division=accessories", ActiveWorkbook
End Sub
Sub DoSave()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
automationObject.SaveDataOnServer
End Sub
Sub GetElements()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
Dim result() As String
result = automationObject.GetElements("Delta", "Product")
Dim size
size = UBound(result)
With ActiveSheet
Range(.Cells(10, 2), .Cells(size + 10, 2)).Value2 = result
End With
End Sub
Sub ExecuteScript()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
Dim result() As Variant
result = automationObject.ExecuteScript("Database ""Delta""" & vbCrLf & "Select" & vbCrLf & """Year"" ""2003"" ""2004"" ""2005""" & vbCrLf & "End Select" & vbCrLf & "Table""Titolo Layout"" ShowHeaders ShowHorizontalGrid ShowVerticalGrid Indent 10" & vbCrLf & "ByRow ""Division"" ""Product Group"" ""Product"" HideEmptyRows" & vbCrLf & "ByColumn ""Year"" ""Quarter""" & vbCrLf & "Show ""Gross Sales""" & vbCrLf & "End Table")
Dim size
size = UBound(result, 1)
Dim size2
size2 = UBound(result, 2)
With ActiveSheet
Range(.Cells(10, 2), .Cells(size + 10, size2 + 2)).Value2 = result
End With
End Sub
Sub SaveUndoMode()
Dim addin As Office.comaddin
Dim automationObject As Object
Set addin = Application.COMAddIns("BoardExcelAddIn")
Set automationObject = addin.Object
automationObject.SetSaveUndoMode (True)
End Sub