VBA Automated Import and Export

dEVELOPER topic

 

The Excel Import/Export Add-On provides three VBA functions for process automation that can be used to import and export data from/to Excel files.  These functions can be used independently of the user interface and regardless of whether a translation project is open or closed at that time.

 

 

Testing

The VBA module "Automation" has three (sub)procedures for running each of the automation functions for testing.

These test procedures are:

OnTest_ExportActiveProject

OnTest_ExportWorkspaceProjects

OnTest_ExportWorkspaceProjects

 

 

"ExcelImport" Function

Imports the data from an Excel spreadsheet to a designated translation project.  If a source file name is given the data will only be imported for that specific file- otherwise the import will be performed for all the files in the translation project.

Function ExcelImport(

ByRef ProjFileName As String,

SrcFileNameExport As String, _

ExcelFilename As String, _

srcLang As String, tgtLang As String, _

OverwriteExistingTransl As Boolean, _

bCmpID As Boolean,

bCmpSrcFileName As Boolean,

bCmpResType As Boolean) As Long

 

 

"Export2Excel" Function

Exports the data from a designated translation project.  If a source file name is given then only the data from that specific file will be exported- otherwise the data from all the files in the translation project will be exported.

Function Export2Excel(

ProjFileName As String,

SrcFileNameExport As String,

ByRef DictSelItem As Scripting.Dictionary, _

srcLang As String, tgtLang As String, _

ExcelFilename As String,

AppendData As Boolean,

withAmpersand As Boolean,

Translated As Boolean,

NonTranslated As Boolean,

ChangedSrc As Boolean, _

bProgressDlg As Boolean,

ByRef bCanceled As Boolean, _

bCloseExcel As Boolean) As Long

 

 

"ExportWorkspaceProjects" Function

Exports the data of all translation projects within the current workspace.

Function ExportWorkspaceProjects(

outExcelFileFormatStr As String, tgtLang As String, _

Translated As Boolean,

NonTranslated As Boolean,

ChangedSrc As Boolean, _

bProgressDlg As Boolean,

ByRef bCanceled As Boolean) As Boolean