Simple arithmetic with DOCVARIABLES 
Author Message
 Simple arithmetic with DOCVARIABLES

Hi

Any idea how I can create a field that takes the contents of a DOCVARIABLE
and carries out some simple arithmetic with it for example I would like to
do something like....

{={DOCVARIABLE "MyVariable"} / 1000}

every combination that I try which includes the docvariable field definition
throws up a syntax error

Thanks in advance

Andrew Wiles



Sat, 15 May 2004 00:28:36 GMT  
 Simple arithmetic with DOCVARIABLES
Hi Andrew,

Quote:
> {={DOCVARIABLE "MyVariable"} / 1000}

Your example works for me. Have you tried updating the field (select the
field, right-click -> Update Field). Are you inserting the braces with
Ctrl-F9 ?

--
ibby

Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.



Sat, 15 May 2004 00:50:48 GMT  
 Simple arithmetic with DOCVARIABLES
Works for me.  (But apparently it's only computed to 2 decimal places.)

When you assign the doc variable, are you using quotes around the value
paramter, e.g., Value="88"?  This might cause it to be interpreted as a
string rather than a number (though it didn't when I tried....).

If that doesn't work, is there another way to accomplish what you're
trying to do?  Could you set a custom document property instead, with
its type set to msoPropertyTypeNumber, and use the {DOCPROPERTY} field
instead?


-- See the MVP FAQ at http://www.mvps.org/word ------------------------
--------------- "Life is nothing if you're not obsessed." --John Waters
-----------------------------------------------------------------------
Please reply only to the newsgroup.

Quote:

> Hi

> Any idea how I can create a field that takes the contents of a DOCVARIABLE
> and carries out some simple arithmetic with it for example I would like to
> do something like....

> {={DOCVARIABLE "MyVariable"} / 1000}

> every combination that I try which includes the docvariable field definition
> throws up a syntax error

> Thanks in advance

> Andrew Wiles



Sat, 15 May 2004 05:03:48 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Very simple arithmetic operation

2. Problems with DOCVARIABLES

3. Word--->DocVariables-Fields, Excel--->?

4. DocVariables short syntax doesn't work?

5. DocVariables in template, not in document

6. DocVariables and Variables

7. DocVariables

8. arithmetic problem in a VB module

9. Error handling / Arithmetic overflow error

10. Arithmetic operation resulted in an Overflow in FilePut

11. Performing arithmetic on unit.pixel properties

12. arithmetic overflow without overflow

 

 
Powered by phpBB® Forum Software