View Single Post
  #7   Report Post  
Posted to microsoft.public.word.pagelayout
Jean-Guy Marcil[_2_] Jean-Guy Marcil[_2_] is offline
external usenet poster
 
Posts: 373
Default Making one change to change all pages in Word 2007

"Cathy" wrote:

Yes, each tax billl has an embeded Excel object (house valuation times the
current tax rate per $100). The only thing I have to change is the tax rate
on each bill. All bills are under one MS document, one tax bill for each
page. This way all I have to do each year is change the rate if it changes
or change the owner when a home sells. If anyone knows of an easier way to
achieve this, I am always up for an easier way. I just thought this would be
the easiest and keep each years taxes in one document.


You will need a macro to do this.

Sub UpdateTaxRate()

'Set a reference to Microsoft Excel "x.0" Object Library from _
Tools References... in the VBA editor window

Dim ishpExcel As InlineShape
Dim oOle As Word.OLEFormat
Dim objExcel As Excel.Workbook
Dim rngCurrent As Range

Application.ScreenUpdating = False

Set rngCurrent = Selection.Range

For Each ishpExcel In ActiveDocument.InlineShapes
With ishpExcel
.OLEFormat.Activate
Set objExcel = .OLEFormat.Object
With objExcel.ActiveSheet
'Assuming tax rate is in cell located _
at third row and second column
.Cells(3, 2).Value = 11.5
End With
Set objExcel = Nothing
End With
Next

SendKeys "{ESC}"

rngCurrent.Select

Application.ScreenRefresh
Application.ScreenUpdating = False

End Sub


If you need help with using macros, see
http://word.mvps.org/faqs/macrosvba/CreateAMacro.htm