TDM Excel Add-In: COM Automation

Publish Date: Sep 10, 2009 | 14 Ratings | 2.57 out of 5 | Print | 1 Customer Review | Submit your review

Overview

Use the TDM Excel Add-In COM-API to load TDM/TDMS files into Microsoft Excel using VBA. Once TDM Excel Add-In is installed, the TDM COM Automation object can be used in Microsoft Excel 2003 and Excel 2007. The TDM Excel Add-In implements the Office 2003 VBA COMAddIn Interface. Use the COMAddIn Interface to connect the TDM Excel Add-In to the Excel application. See Microsoft Office VBA language reference for details.

Object Name

      ExcelTDM.TDMAddin
      (This name is case sensitive)

Object Methods & Properties

Object

Method Name: Object.ImportFile(TDMFileName[, SilentMode])
Description: Imports a TDM/TDMS file, fills the data to a new workbook. The new workbook will be activated after importing the TDM/TDMS file.
Its object can be accessed from ActiveWorkbook.

Parameter

Description

TDMFileName

Variant (String). The full TDM/TDMS file name including the path.

[SilentMode]

Variant (Boolean). SilentMode indicates whether to show the Select Index Dialog box when the channel data number exceeds the maximum row number in Excel. The Select Index Dialog box is shown when SilentMode is False. The value of the start index is always 1 if SilentMode is True. The default value is True.

Method Name: Object.ShowConfigDlg()
Shows the Configuration dialog box to configure the import settings. All versions and instances of Excel share the same configuration settings. This method does not return until the Configuration dialog box is closed.

Method Name: Object.ShowAboutDlg()
Shows the About dialog box. This method does not return until the About dialog box is closed.

Property Name: Object.Config
Configures the import settings. If the configuration is changed via the script, the configuration is only modified in the current Excel instance. Use Object.Config.Save() method to change the global configuration settings for all Excel instances.

 

 

 

Object.Config

Method Name: Object.Config.Load()
Forces the loading of the global configuration of all Excel instances.

Method Name: Object.Config.Save()
Overwrites the global configuration of all Excel instances.

Property Name: Object.Config.RootProperties
The configuration for Root properties.

Property Name: Object.Config.GroupProperties
The configuration for Group properties.

Property Name: Object.Config.ChannelProperties
The configuration for Channel properties.

Property Name: Object.Config.AutoFitColumns
Set AutoFitColumns to True to adjust the column width to the cells content. The default value is True.

Object.Config.RootProperties

Method Name: Object.Config.RootProperties.Select(PropertyName[, Index])
Adds the property PropertyName to the Root property list. If an index is specified, the property is inserted at position Index. Otherwise the new property is appended at the end of the list.

Parameter

Description

PropertyName

Variant (String). PropertyName is case insensitive. The supported property name could be one of the following values:
"Author", "Title", "Date/Time", "Description"
Deprecated: "RegisterTxt1", "RegisterTxt2", "RegisterTxt3"
The PropertyName could also be "Groups", which defines the group count.

[Index]

Variant (Integer). Index indicates the position in the selected Root property list where the new property is inserted. Index starts from 0 to the count of RootProperties. If the index is invalid, the new property is appended at the end of the selected property list.

Method Name: Object.Config.RootProperties.Deselect(PropertyName)
Deselects the property PropertyName from the Root property list.

Parameter

Description

PropertyName

Variant (String). PropertyName is case insensitive. The property name could be one of the following values:
"Author", "Title", "Date/Time", "Description"
Deprecated: "RegisterTxt1", "RegisterTxt2", "RegisterTxt3"
The PropertyName could also be "Groups", which defines the group count.

Method Name: Object.Config.RootProperties.SelectAll()
Inserts all supported properties to the Root property list.

Method Name: Object.Config.RootProperties.DeselectAll()
Deletes all properties from the Root property list.

Property Name: Object.Config.RootProperties.SelectedProperties
One-dimensional array of the property strings in the selected Root property list. SelectedProperties is Read-Only. If you need to select a new property, use the Object.Config.RootProperties.Select method.

Property Name: Object.Config.RootProperties.SelectCustomProperties
Set the SelectCustomProperties value to True to import all custom properties into Excel. The default value is True.

Object.Config.GroupProperties

Method Name: Object.Config.GroupProperties.Select(PropertyName[, Index])
Adds the property PropertyName to the Group property list. If an index is specified, the property is inserted at position Index. Otherwise the new property is appended at the end of the list.

Parameter

Description

PropertyName

Variant (String). PropertyName is case insensitive. The supported property name could be one of the following values: 
"Description"
Deprecated: "RegisterTxt1", "RegisterTxt2", "RegisterTxt3"
The PropertyName could also be "Channels", which defines the channel count of this group.

[Index]

Variant (Integer). The position in the selected Group property list where the new property is inserted. Index starts from 0 to the count of GroupProperties. If the index is invalid, the new property is appended to the end of the selected property list.

Method Name: Object.Config.GroupProperties.Deselect(PropertyName)
Deselects the property PropertyName from the Group property list.

Parameter

Description

PropertyName

Variant (String). PropertyName is case insensitive. The supported property name could be one of the following values: 
"Description"
Deprecated: "RegisterTxt1", "RegisterTxt2", "RegisterTxt3"
The PropertyName could also be "Channels".

Method Name: Object.Config.GroupProperties.SelectAll()
Inserts all supported properties in the Group property list.

Method Name: Object.Config.GroupProperties.DeselectAll()
Deletes all properties from the Group property list.

Property Name: Object.Config.GroupProperties.SelectedProperties
One-dimensional array of the property strings in the selected Group property list. This property is Read-Only. If you need to select a new property, use the Object.Config.GroupProperties.Select method.

Property Name: Object.Config.GroupProperties.SelectCustomProperties
Set the SelectCustomProperties value to True to import all custom properties into Excel. The default value is True.

 

Object.Config.ChannelProperties

Method Name: Object.Config.ChannelProperties.Select(PropertyName[, Index])
Adds the property PropertyName to the Channel property list. If an index is specified, the property is inserted at position Index. Otherwise the new property is appended at the end of the list.

Parameter

Description

PropertyName

Variant (String). PropertyName is case insensitive. The property name could be one of the following values:
"Datatype", "Unit", "Length", "Minimum", "Maximum", "Description".
Deprecated: "RegisterInt1", "RegisterInt2", "RegisterInt3", "RegisterInt4", "RegisterInt5", "RegisterInt6"
Deprecated: "RegisterTxt1", "RegisterTxt2", "RegisterTxt3"
Deprecated: "RegisterVal1", "RegisterVal2", "RegisterVal3", "RegisterVal4", "RegisterVal5", "RegisterVal6"

[Index]

Variant (Integer). The position in the selected Channel property list where the new property is inserted. Index starts from 0 to the count of ChannelProperties. If the index is invalid, the new property is appended to the end of the selected property list.

Method Name: Object.Config.ChannelProperties.Deselect(PropertyName)
Deselects the property PropertyName from the Channel property list.

Parameter

Description

PropertyName

Variant (String). PropertyName is case insensitive. The property name could be one of the following values:
"Datatype", "Unit", "Length", "Minimum", "Maximum", "Description".
Deprecated: "RegisterInt1", "RegisterInt2", "RegisterInt3", "RegisterInt4", "RegisterInt5", "RegisterInt6"
Deprecated: "RegisterTxt1", "RegisterTxt2", "RegisterTxt3"
Deprecated: "RegisterVal1", "RegisterVal2", "RegisterVal3", "RegisterVal4", "RegisterVal5", "RegisterVal6"

Method Name: Object.Config.ChannelProperties.SelectAll()
Inserts all supported properties in the Channel property list.

Method Name: Object.Config.ChannelProperties.DeselectAll()
Deletes all properties from the Channel property list.

Property Name: Object.Config.ChannelProperties.SelectedProperties
One-dimensional array of the property strings in the selected Channel property list. This property is Read-Only. If you need to select a new property, use the Object.Config.ChannelProperties.Select method.

Property Name: Object.Config.ChannelProperties.SelectCustomProperties
Set the SelectCustomProperties value to True to import all custom properties into Excel. The default value is True.

 

VBA Sample Codes

  

'Get TDM Excel Add-In
Dim obj As COMAddIn
Set obj = Application.COMAddIns.Item("ExcelTDM.TDMAddin")
obj.Connect = True

'Confirm only importing "Description" properties for Root
Call obj.Object.Config.RootProperties.DeselectAll
Call obj.Object.Config.RootProperties.Select("Description")

'Show the group count as property
Call obj.Object.Config.RootProperties.Select("Groups")

'Select all the available properties for Group
Call obj.Object.Config.GroupProperties.SelectAll

'Import custom properties
obj.Object.Config.RootProperties.SelectCustomProperties = True
obj.Object.Config.GroupProperties.SelectCustomProperties = True
obj.Object.Config.ChannelProperties.SelectCustomProperties = True

'Let the user choose which file to import
Dim fileName
fileName = Application.GetOpenFilename("TDM & TDMS (*.tdm;*.tdms),*.tdm;*.tdms")
If fileName = False Then
' User selected Cancel
Exit Sub
End If

'Import the selected file
Call obj.Object.ImportFile(fileName)

'Record down the current workbook
Dim Workbook As Object
Set Workbook = ActiveWorkbook

'Process the imported data
'...


Related Links:
Download the TDM Excel Add-In for Microsoft Excel
TDM Excel Add-In for Microsoft Excel User Guide

Back to Top

Customer Reviews
1 Review | Submit your review

Sample code for use with .NET  - Feb 16, 2011

Is there a code sample for how to automate the add-in from within a Visual Basic .NET application?

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit