Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
CJ Brown CJ Brown is offline
external usenet poster
 
Posts: 1
Default Table refresh / referencing from VBA

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.
  #2   Report Post  
Posted to microsoft.public.word.tables
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Table refresh / referencing from VBA

Hi ?B?Q0ogQnJvd24=?=,

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:

Set tbTemp = Selection.Tables(1)

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


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
20x20 multiplication table Bob S Tables 2 December 24th 05 02:27 PM
Populate Table from Access MTechG Mailmerge 8 December 16th 05 07:08 PM
Table Format Style vs. Table Text Style WebColin Page Layout 11 December 1st 05 11:29 PM
Row height problem with table in table Stephanie T. Tables 0 November 23rd 04 03:35 PM
Getting the format of a table Kind writer/user/programmer Tables 0 October 29th 04 02:52 AM


All times are GMT +1. The time now is 02:51 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"