Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi to all,
I have a problem using Dynamic Update Command. I need to insert all the rows of a linear table into another one. I did it with a for .. next statement
The macro is here below
sub list
Dim strsql
set obj = ActiveDocument.GetSheetObject("CH02")
MsgBox ("number of rows " & obj.GetRowCount-1)
set curDoc = ActiveDocument.GetProperties
curDoc.EnableDynamicDataUpdate=true
ActiveDocument.SetProperties curDoc
for RowIter = 2 to obj.GetRowCount-1
set cell = obj.GetCell(RowIter,1)
set cell2 = obj.GetCell(RowIter,10)
MsgBox(RowIter & " " & cell.Text & " " & cell2.Text)
strsql = "INSERT INTO prova (monthyear, percentualeRientri) VALUES ('"& cell.Text & "','" &cell2.Text &"')"
set Result = ActiveDocument.DynamicUpdateCommand (strsql)
if Result = false then
MsgBox Result.ErrorMessage
end if
next
ActiveDocument.Save
end sub