Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

How to capture when a value inside a Content Control changes without actually entering or exiting the Content Control?

$
0
0

Here's my situation:  Using Word 2010 and Sharepoint 2010.  In the Word document, I have a Document Information Panel (DIP) that displays fields/values from a Sharepoint document library.  For the most part, the Quick Parts/Content Controls corresponding to the Sharepoint fields that I have inserted into the Word document work well. 

The field I need help on is a Sharepoint number field (it will be involved in calculations).  When I enter a number into the field in the DIP, it is formatted with thousand separators, e.g. 333,345,666.78.  However, the Content Control in the document just shows numbers, e.g. 333345666.78.  I need to make both fields show the commas.

I tried using switches within the content control, e.g. ${=[Acres] \# "#,##0.00"}  (and I am using Ctrl-F9 to create the {}) but I either get a blank value or I get a value in the document that doesn't change when I update the field in the DIP and that doesn't go to zero when I delete the value in the DIP (even if I right click and choose Update Field within the document).

Next I tried creating a macro that would format the actual value of the Content Control.  However, because of the connection to the numeric Sharepoint field, that wasn't possible.

Then I tried creating a new, unbound plain text Content Control (from the Developers tab) that would contain the value from the DIP field (formatted, of course).  But that doesn't work if the value is changed in the DIP because Content Control events only run on physical entry and exit of the Content Control.  (The macro works great if I go into the control in the document and physically change the value there but that's not what I need.)  There just isn't an event that corresponds to the value actually changing within the Content control if it's done from elsewhere.

I downloaded and looked at Greg Maxey's Content Control Monitoring macros but, far as I can tell, they all rely on physically going and and out of a Content Control.  (If I'm wrong, Greg or someone else, please point what I'm missing.)

To make a long story short, is there anyway to monitor changes within Content Controls that don't rely on physically entering/exiting the control?  If I can do that, I can capture the new value, transfer it to the plain text Content Control, and format it there.

Thanks in advance for your help.  Carol.


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>