wdCalculationText then what?

S

Shelly

With ActiveDocument.FormFields.Add
(Range:=Selection.Range, _
Type:=wdFieldFormTextInput)
.TextInput.EditType Type:=wdCalculationText, _
Default:="", _
Expression:=MyCalculation (this is not correct
syntax!)
End With

This is a snippet of code from a macro I'm attempting in
Word2000. I am trying to automate a form, adding a row in
a table that includes a calculation form field.

I can get the macro to add the row, add the form fields,
but I can't seem to get the macro to modify the form field
properties to add a table calculation that multiplies b12
& d12 -- the second and fourth cells in row 12 of a table.

Does anyone have any ideas? Any work arounds?
 
D

Doug Robbins - Word MVP

Hi Shelly,

Do it this way:

Dim newformfield As FormField
Set newformfield = ActiveDocument.FormFields.Add(Range:=Selection.Range,
Type:=wdFieldFormTextInput)
newformfield.TextInput.EditType Type:=wdCalculationText, Default:="=b12 *
d12", Format:="0.00", Enabled:=False

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top