View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Button Macro for Caclulating in Word Tables

Hi Ned,

To see how to reference cells in another table in Word, check out my Word Field Maths 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=365442
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Reference Table Cells From Outside The Table'

To force a re-calc in the linked table, simply select the cell(s) concerned and press F9. Alternatively, you could insert a
MACROBUTTON field onto the linked table, coded as {MACROBUTTON CalcTable Update} and use the following macro:

Sub CalcTable()
Dim oFld As Field
For Each oFld In Selection.Tables(1).Range.Fields
oFld.Update
Next
End Sub

Note: The field brace pairs (ie '{ }') for the MACROBUTTON field are created via Ctrl-F9 - you can't simply type them or copy &
paste them from this message.

Similar macro code could be used for a command button.

--
Cheers
macropod
[MVP - Microsoft Word]


"Ned23" wrote in message ...
Can anyone can point me to an example of a macro that you would assign to a
command button in Word 2007 that calculates a result based on values from
multiple cells in one table and puts that result in another cell in a
separate table?

I've been told that I cannot link Excel spreadsheets for this application;
it has to be stand-alone Word. So, I either have to do this in Word or not
do it.

Any help would be appreciated,
Thanks.