ContentControlOnExit

S

shg

Hi,

I have some new ContentControls in my Word2007 Document. I can add and
change Text with VBA code.

But I cannot catch a change in the ControlFields with ContentControlOnExit.
Can someone please guide me into the right dircection with some sample lines
of VBA Code?

Tanks in Advance
Hans
 
G

Gregory K. Maxey

I suppose you would have to store what was in the CC when you entered it to
what is in is when you exit. Something like this:

Private Sub Document_ContentControlOnEnter(ByVal currentCC As
ContentControl)
ActiveDocument.Variables("CCContent").Value = currentCC.Range.Text
End Sub

Private Sub Document_ContentControlOnExit(ByVal currentCC As ContentControl,
Cancel As Boolean)
If currentCC.Range.Text <> ActiveDocument.Variables("CCContent").Value Then
MsgBox "The CC content has changed"
End If
End Sub



If> Hi,
 
S

shg

Thanx a lot Gregory for your fast and valuable help!!

Thats exactly what I was looking for. Stupid, that I was not able to figure
it out myself :eek:(

Best regards
Hans
 

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