C
CJ Brown
Just wondering how to get the reference to the table the insertion point is
in from VBA when a macro is called. I've got around table refresh by forcing
a refresh of all cells in the current doc:
Sub RefreshAllTables()
Dim tbTemp As Table
Dim cellTemp As Cell
For Each tbTemp In ActiveDocument.Tables
For Each cellTemp In tbTemp.Range.Cells
cellTemp.Range.Fields.Update
Next
Next
End Sub
This was fine for a while, but its getting a bit slow now the doc has grown
(and its a nasty fix, whereas I'd like an elegant one). If I could get a
refernce for the table that the insertion point was in, I could have a macro
just to recalc that table. Now I think of it, it might be better just to
force a refresh of only the calculation cells in all the tables ... I'm a bit
new to Word VBA. I'm using Word XP/2002.
in from VBA when a macro is called. I've got around table refresh by forcing
a refresh of all cells in the current doc:
Sub RefreshAllTables()
Dim tbTemp As Table
Dim cellTemp As Cell
For Each tbTemp In ActiveDocument.Tables
For Each cellTemp In tbTemp.Range.Cells
cellTemp.Range.Fields.Update
Next
Next
End Sub
This was fine for a while, but its getting a bit slow now the doc has grown
(and its a nasty fix, whereas I'd like an elegant one). If I could get a
refernce for the table that the insertion point was in, I could have a macro
just to recalc that table. Now I think of it, it might be better just to
force a refresh of only the calculation cells in all the tables ... I'm a bit
new to Word VBA. I'm using Word XP/2002.