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

Re: ContentControlOnExit by Gregory

Gregory
Mon May 19 20:05:49 PDT 2008

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,
>
> 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



Re: ContentControlOnExit by shg

shg
Tue May 20 08:04:01 PDT 2008


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 :o(

Best regards
Hans

"Gregory K. Maxey" wrote:

> 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,
> >
> > 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
>
>
>