Sub
TMexports()
Dim
oWorkbench
As
TW4Win.Application
Dim
oTM
As
TW4Win.TranslationMemory
Dim
oOptionsGeneral
As
TW4Win.OptionsGeneral
Dim
oProperties
As
TW4Win.Properties
Set
oWorkbench = GetObject(,
"TW4Win.Application"
)
Set
oTM = oWorkbench.TranslationMemory
Set
oOptionsGeneral = oWorkbench.OptionsGeneral
SaveOptionsMode = oOptionsGeneral.ShowProjectSettings
oOptionsGeneral.ShowProjectSettings =
False
Open
"D:\_Workdir\Exports_TM-List.txt"
For
Output
As
#2
Count = 1
Set
fs = Application.FileSearch
With
fs
.NewSearch
.LookIn =
"D:\_WorkDir"
.FileName =
"*.tmw"
.SearchSubFolders =
True
.FileType = msoFileTypeAllFiles
If
.Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0
Then
Debug.Print
"There were "
& .FoundFiles.Count &
" file(s) found."
For
i = 1
To
.FoundFiles.Count
If
InStr(1, .FoundFiles(i),
"_TMs_TW1"
) = 0
Then
oTM.Open .FoundFiles(i),
"AP"
Set
oProperties = oTM.Properties
ExportFile =
"D:\_Workdir\TMexport-"
+
CStr
(Count) +
".tmx"
Debug.Print Count, ExportFile, oTM.FileName
With
oProperties
Print #2,
CStr
(Count) + Chr(9) + .Name
End
With
oTM.Export ExportFile, twbFormatTMX
oTM.Close
Count = Count + 1
Else
Debug.Print
"Skipped"
End
If
Next
i
Else
MsgBox
"There were no files found."
End
If
End
With
Close #2
oOptionsGeneral.ShowProjectSettings = SaveOptionsMode
Kill
"D:\_Workdir\*.iix"
Kill
"D:\_Workdir\*.mdf"
Kill
"D:\_Workdir\*.mtf"
Kill
"D:\_Workdir\*.mwf"
Kill
"D:\_Workdir\*.tmw"
End
Sub