Documentation Center

Automating other applications from Passolo

In order to use another application in a Passolo macro, you should add a reference to the object.

Open the dialog References by selecting the menu Edit followed by References.

To use for example Microsoft Excel, select the Microsoft Excel Object Library. If you use objects of the Microsoft Excel Object Library in the script you will get context sensitive help about the available properties, methods and parameters.

The following macro demonstrates how to open Excel, create a workbook and add data from a translation list to the sheet.

Sub Main 
 ' Get a translation list 
 Dim trn As PslTransList 
 Set trn = PSL.Projects(1).TransLists(1) 
 If trn Is Nothing Then Exit Sub 

 ' Open Excel and create a workbook 
 Dim ex As Excel.Application 
 Set ex = CreateObject("Excel.Application") 

 Dim wb As Excel.Workbook 
 Set wb = ex.Workbooks.Add 
 ' Add soure strings, translated string anddescriptions 

 Dim i As Long 
 For i = 1 To trn.StringCount 
  With wb.ActiveSheet 
   .Range("a" & CStr(i)) = trn.String(i).SourceText
   .Range("b" & CStr(i)) = trn.String(i).Text 
   .Range("c" & CStr(i)) = trn.String(i).Description 
  End With 
 Next i 
 ex.Visible =True 
 MsgBox("Click to close Excel") 
 ex.Quit 
End Sub