View Single Post
  #7   Report Post  
Posted to microsoft.public.word.tables
pedro gracio pedro gracio is offline
external usenet poster
 
Posts: 1
Default Formula to calculate sum based on drop down form fieldsin Word - macropod

Hi,

This seems to work pretty well in word 2000 until it is used in a large document that has a table of contents. It seems to need some sort of refresh.

I also tried this macro and although it also seems to work, it results in making the pages scroll up & down. This of course would be quite painful for the user.

Here's that code :

Sub AddDropDownResults()

Dim dDown1, dDown2, dDown3, dDown4, dDown5, dDown6, dDown7, As Integer
' Get value of first drop down form field.
dDown1 = Val(ActiveDocument.FormFields("DropDown1").Result)
' Get value of second drop down form field.
dDown2 = Val(ActiveDocument.FormFields("DropDown2").Result)
' Get value of thrid drop down form field.
dDown3 = Val(ActiveDocument.FormFields("DropDown3").Result)
' Get value of fouth drop down form field.
dDown4 = Val(ActiveDocument.FormFields("DropDown4").Result)
' Get value of fifth drop down form field.
dDown5 = Val(ActiveDocument.FormFields("DropDown5").Result)
' Get value of sixth drop down form field.
dDown6 = Val(ActiveDocument.FormFields("DropDown6").Result)
' Get value of seveth drop down form field.
dDown7 = Val(ActiveDocument.FormFields("DropDown7").Result)
' Calculate results and place in Text1 form field
ActiveDocument.FormFields("Text1").Result = Str(dDown1 + dDown2 + dDown3 + dDown4 + dDown5 + dDown6 + dDown7)

End Sub


Any help would be greatly appreciated

Thanks

Pedy