..2 Form


Open form from the previous example

In the XLSX Workbench, open form SHIPPING_LABELS from previous example and select root node in the form structure tree .


 

Insert Final post-processing VBScript - routine 


Press button   . It is placed on the Properties tab, in the "Final post-processing" item . 
Code editor window will appear : 



Insert below code into editor:


Sub Entry()

  ' add new worksheet
  Set MySheet = XLWB_ActiveWorkbook.Sheets.Add
  MySheet.Name = "TestVBScript"

  ' get table, which we have chosen from context and named T_LABELS
  Set MyTable = XLWB_ActiveWorkbook.Container.Tables("T_LABELS").Table

  ' loop at table
  For i = 1 To MyTable.Rows.Count
    Set MyTableRow = MyTable.Rows(i)

    MySheet.Cells(i, 1).Value = MyTableRow.Cell(1)  'Name
    MySheet.Cells(i, 2).Value = MyTableRow.Cell(2)  'Street
    MySheet.Cells(i, 3).Value = MyTableRow.Cell(3)  'Town
    MySheet.Cells(i, 4).Value = MyTableRow.Cell(4)  'State
    MySheet.Cells(i, 5).Value = MyTableRow.Cell(5)  'Zip
  Next

End Sub

 

Specify table to transfer from context to VBScript-routine

Press button  , which is placed right from the previous. Popup screen with context tables (available for providing to routine) will appear. You should set checkbox for tables, which you want to provide to Final post-processing routine; you also should name tables (the name will be used for access to each table in the routine) . 

Note 1: Only tables on top nesting level of context are available for choosing .
Note 2: Choose only tables consisting of simple fields (without nested tables and structures).

Let's choose the only available table and name it T_LABELS (with this name the table will be available in VBScript-routine):

 


Activate the Form by pressing a button 

Form is ready to use.