-
Macro - Loop Through Table
Dave Riley Mar 24, 2012 4:53 PM (in response to cache.merrill)Hi,
From API Guide.qvw ...
set TableBox = ActiveDocument.GetSheetObject( "TB01" )
for RowIter = 0 to TableBox.GetRowCount-1
for ColIter =0 to TableBox.GetColumnCount-1
set cell = TableBox.GetCell(RowIter,ColIter)
msgbox(cell.Text)
next
next
flipside
-
Macro - Loop Through Table
ianmcgivern Mar 25, 2012 6:40 PM (in response to Dave Riley)Hi flipside
Where in the API did you get this? The Automation Examples sheet? If so, what search did you do on member?
-
Macro - Loop Through Table
Dave Riley Mar 26, 2012 4:22 AM (in response to ianmcgivern )Hi Ian,
I'm working in QV10 and got it from ...
Class = TableBox
Member = GetCell
... showing as introduced in 6.0x.
flipside
-
Macro - Loop Through Table
cache.merrill Mar 26, 2012 1:43 PM (in response to Dave Riley)If I don't want to loop through each column but just get a value from one column how would i do that?
set TableBox = ActiveDocument.GetSheetObject( "tb_emails_to_send" )
for RowIter = 0 to TableBox.GetRowCount-1
set cell = ?
msgbox(cell.Text)
next
-
Macro - Loop Through Table
Stephen Charles Mar 26, 2012 2:21 PM (in response to cache.merrill)This code moves from column to column and row to row and keepings counting. It gets the value in the 16th spot in the loop and puts into the variable vValue and exits the sub routine.
hths,
Stephen
sub ParetoCountInvValue1
vCounter1 = 0
vCounter2 = 0
set table = ActiveDocument.GetSheetObject( "CH01" )
for RowIter = 0 to table.GetRowCount-1
for ColIter =0 to table.GetColumnCount-1
set cell = table.GetCell(RowIter,ColIter)
vCounter1 = vCounter1 + 1
if vCounter1 = 16 then
'msgbox ColIter
'msgbox(cell.Text)
set v = ActiveDocument.Variables("vValue")
v.SetContent cell.Text,true
exit sub
else
end if
next
next
end sub
-
Macro - Loop Through Table
Dave Riley Mar 26, 2012 5:17 PM (in response to cache.merrill)You just need to specify the column index (starting at zero for column 1) so looping through values in the first column would need...
set cell = TableBox.GetCell(RowIter,0)
flipside
-
-
-
-