force content control update

Hello,

 

I found some VBA similar to the following to create a dependent control. I pick a name from a combo box and the appropriate signature block is displayed. It works fine but you need to exit the content control before the code executes. Is there another event or a trick so that I can pick the value from the combo box and see "live updates" without exiting the control?

 

Thanks in advance,

Mark

 

Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
 Dim oCC As ContentControl
 Dim oTmp As Template
 Select Case CC.Title
 Case "Pick"
 Set oCC = ActiveDocument.SelectContentControlsByTitle("Picked").Item(1)
 Set oTmp = ActiveDocument.AttachedTemplate
 oCC.LockContents = False
 Select Case CC.Range.Text
 Case "Bob"
 oTmp.BuildingBlockTypes(wdTypeCustom1).Categories("Demo").BuildingBlocks("BobSign").Insert oCC.Range
 Case "Steve"
 oTmp.BuildingBlockTypes(wdTypeCustom1).Categories("Demo").BuildingBlocks("SteveSign").Insert oCC.Range
  Case "Mary"
 oTmp.BuildingBlockTypes(wdTypeCustom1).Categories("Demo").BuildingBlocks("MarySign").Insert oCC.Range
 End Select
 oCC.LockContents = True
 End Select
 End Sub

Answer
Answer
It is no walk in the sun, but you can create custom CC events like a change event:
http://gregmaxey.mvps.org/word_tip_pages/content_control_custom_events.html
Greg Maxey
***
Death smiles at us all, but all a man can do is smile back.


For more help with Word visit:
http://gregmaxey.com/word_tips.html

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 148 Applies to: