Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Black_Hole
Creator II
Creator II

Call a field from TableBox in a macro

Hello all,

I load an excel file in QV.

Then, I create a TableBox object with the main fields from my excel file.

I would like to build a macro calling the fields of my TableBox.

In Visual Basic (in excel), it’s similar to do: worksheets(“Sheet1”).cells(“A1:A1”).value or ThisWorkbook.Worksheets("Sheet1")

I think there is an equivalence in QV.

Please could you help me to call a particular field from my table box in a QV macro.

Thank you in advance for your help.

Labels (2)
1 Solution

Accepted Solutions
m_woolf
Master II
Master II

This is from the API Guide:

set table = ActiveDocument.GetSheetObject( "CH01" )
CellRect = ActiveDocument.GetApplication().GetEmptyRect()
CellRect.Top = 0
CellRect.Left = 0
CellRect.Width = table.GetColumnCount
CellRect.Height = table.GetRowCount
set CellMatrix = table.GetCells( CellRect )
for RowIter = 0 to CellMatrix.Count-1
     for ColIter=0 to CellMatrix.Item(RowIter).Count-1
           set cell = CellMatrix.Item(RowIter).Item(ColIter)
          msgbox(cell.Text)
     next
next

View solution in original post

4 Replies
m_woolf
Master II
Master II

The attached qvw contains a macro that recalls the values of each field in the tablebox.

Black_Hole
Creator II
Creator II
Author

Hello @m_woolf,

Thank you for your help but I can't open the file test1.qvw due to the security of my computer.

Please could you show me the macro of this file in screenshot or message.

Thank you in advance for your consideration.

m_woolf
Master II
Master II

This is from the API Guide:

set table = ActiveDocument.GetSheetObject( "CH01" )
CellRect = ActiveDocument.GetApplication().GetEmptyRect()
CellRect.Top = 0
CellRect.Left = 0
CellRect.Width = table.GetColumnCount
CellRect.Height = table.GetRowCount
set CellMatrix = table.GetCells( CellRect )
for RowIter = 0 to CellMatrix.Count-1
     for ColIter=0 to CellMatrix.Item(RowIter).Count-1
           set cell = CellMatrix.Item(RowIter).Item(ColIter)
          msgbox(cell.Text)
     next
next

Black_Hole
Creator II
Creator II
Author

Hello @m_woolf ,

Perfect!

The macro run right in my Qlikview and it does exactly what I was looking for.

Thanks a lot @m_woolf  for your help.