I'm trying to export translation units that meets certain criteria in a Passolo project to a TMX file using macro. I've been reading documentation available online to write macro, but it seems that exporting only a subset of translation units from multiple translation lists in a Passolo file is not possible. My understanding by reading the documentation is that you can export translation units in a Passolo file for its entirety to a TMX file using the PslTransBundle object, but not just only certain translation units that meets certain criteria.
Can somebody confirm my understanding is correct?
When exporting using the PslTransBundle object, you can just insert complete translation list objects PslTransList with all items.
If you want to export just parts into a TMX file loop all items within the PslTransList objects that you want to export. That allows you to check your export criteria for each PslTransString
Writing the TMX file also must be part of your code
Thank you for your input. I'm writing codes with a loop to go through all translation units in a Passolo file, evaluate each of them to see if it meets my criteria, and if it does, export the TU to .tmx file. My codes look like this for the loop:For Each lang In prj.Languages 'Create the translation "bundle" for TMX export Dim bundle As PslTransBundle Set bundle = prj.PrepareTransBundle For Each translst In prj.TransLists For i = 1 To translst.StringCount If translst.Language Is lang Then If (translst.String(i).DateTranslated > dateModifiedSpecified) Then translst.String(i).OutputError(lang.LangCode & ": " & translst.String(i).DateTranslated) bundle.AddTransList(translst.String(i)) End If End If Next Next Dim filename As String filename = "C:\_MyWork\Temp\" & lang.LangCode & ".tmx prj.Export "TMX Export", bundle, filenameNext langThe if statement "translst.String(i).DateTranslated > dateModifiedSpecified" evaluates each TU in Passolo file (the dateModifiedSpecified has been already defined at the beginning of the codes), and the "translst.String(i).OutputError" statement is indeed working (the TU that meets the criteria does get displayed in the Messages pane in Passolo), but no .tmx files gets generated under the C:\. Shouldn't the "prj.Export "TMX Export", bundle, filename" creates .tmx file with the above codes?
Hi, Windows 10 you can't write at the root of the c:\ drive. Write the file in a subfolder.
Thank you for your input. My code is actually written to export in a temp dir, not the root of C: drive. I just didn't share that details. I have updated the snippet from my original post now.
The problem in your code is the call bundle.AddTransList(translst.String(i)). You are passing a PslTransString object while the method is expecting a PslTransList object.
That brings me back to my initial answer. If you want export just selected PslTransString objects, you can't use code that is based on PslTransBundle. You need to create a TMX file with XML methods on your own and instead of calling bundle.AddTransList(translst.String(i)) you have to write the complete <tu> object into the file with XML methods.
Thank you for your input.