Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The type of document I have in mind is a bid or a contract. It has many values, such as prices and dates, scattered within the text. For years I have used DOCPROPERTY fields to avoid copying-and-pasting them, where they are the same (e.g. final price may occur 10 or 20 times in a document). But I think this could go even further, as it would be easiest if some values could be calculated from others.

For example, by using field syntax {DOCPROPERTY "final_price"} I can refer to that property as defined in document properties.

Also, field syntax {=100*1.07} will yield 107.

However, if I try this: {={DOCPROPERTY "final_price"} * 1.07}, in various configurations of braces and brackets, all I get is syntax errors.

Documentations is scarce. Can anybody help?

share|improve this question
    
Which version of Microsoft Word ? –  Gnoupi Aug 26 '09 at 20:54
    
From MS Office for Mac 2008, but so far everything regarding fields in Word I've tried is working (or not working) on both Mac and Windows equally. –  ttarchala Aug 26 '09 at 21:02

2 Answers 2

up vote 2 down vote accepted

Make sure to create proper field codes, one inside the other, like this:

  1. Press CTRL + F9
  2. Put in =*1.07 between the braces
  3. Click between = and *
  4. Press CTRL + F9 again
  5. Put in DOCPROPERTY "final_price" between the braces
  6. Press Alt + F9 to toggle field codes
  7. Press F9 to update the field
share|improve this answer
    
I'm sorry, but I can't make it work. Anyway I paste your solution, or try to build the field anew, gives me syntax error both in Word 2008 for Mac and in Word 2007 for Windows. Would you be willing to send me a .doc file with these fields working? –  ttarchala Aug 28 '09 at 8:02
    
Are you creating the fields correctly? I have added the correct steps to my answer. –  subman Aug 28 '09 at 12:00
1  
Your solution as given still didn't work, apparently it's a problem with PRODUCT because even putting in {=PRODUCT(2,2)} produces syntax error. However I can see where my error was. It didn't cross my mind that ALL curly braces in word fields must be inserted by "insert field" operation, even those inside existing fields. So once inside, I was just typing them in. Now that I know it, even this works: { = {DOCPROPERTY "final_price"} * 1.07 } Thanks! –  ttarchala Aug 28 '09 at 13:19
    
Aha! Looks like I made the same mistake, then solved it while playing around with the Functions! Will update the answer to clear up the solution. –  subman Aug 28 '09 at 14:01

After some more searching I arrived at another solution. I haven't been able to make the DOCPROPERTY work, but these steps work:

  1. put the numeric values at the end of your document

  2. bookmark each of them, giving the bookmarks descriptive names

  3. formulas now work with the bookmark names as "variables"\

  4. make the numeric values invisible (e.g. by setting font color) so they don't appear in print.

I think it would be more elegant to use the DOCPROPERTY if anyone can make it work, since leaving invisible text in your documents is clumsy...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.