![]() |
|
#1
|
||||
|
||||
![]()
See, for example: https://www.msofficeforums.com/word/...html#post46429
No VBA code required. The conditional content may include multiple paragraphs, pictures, tables, etc. Graham's example uses content controls, but your post indicates you're using formfields. Content controls and formfields shouldn't be used in the same document. They weren't designed to be used that way and doing so is a known source of problems.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Graham,
Things are slow. So just providing this as another example of the CC BeforeStoreUpdate Event. It takes a bit of work to setup but eliminates the need to exit the CC after making the selection. Create three Paragraph1 CCs with the same text. Tag 1 "Paragraph1", Tag 2 "Paragraph1_Norm" and Tag 3 "Paragraph1_ST" Then set the font in "Paragraph1_ST" as strikethrouh. Now map the Topic_1 and three associated Paragraph1 CCs to a CXMLPart (see image). After that you can delete the "Paragraph1_Norm" and "Paragraph1_ST" CCs from the document. Here is the needed code: Code:
Private Sub Document_ContentControlBeforeStoreUpdate(ByVal CC As ContentControl, Content As String) Dim oNode As CustomXMLNode, oNodeC As CustomXMLNode Select Case CC.Title Case Is = "Topic 1" Set oNode = CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Paragraph1[1]") If Content = "Does Not Apply" Then Set oNodeC = CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Paragraph1_ST[1]") Else Set oNodeC = CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Paragraph1_Norm[1]") End If oNode.Text = oNodeC.Text End Select lbl_Exit: Exit Sub End Sub BREAK Paul, downloaded the document from your link and nothing happens when I change the FF DDL. I may be missing something. |
#3
|
||||
|
||||
![]()
Did you exit the formfield via the TAB key after updating it?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro - Copying and Pasting selected slides (based on selected keywords/criteria) Hi | erickhawe | PowerPoint | 0 | 08-16-2019 09:00 PM |
![]() |
jhansrod | Word VBA | 3 | 06-13-2019 04:46 PM |
![]() |
cmf0106 | Word | 4 | 03-18-2014 04:12 PM |
Display paragraph of text based on value selected in combo | WordWaza | Word | 0 | 08-09-2013 06:30 AM |
Change cell color everytime a value is selected in dropdown list | angelica_gloria | Excel | 4 | 01-27-2012 06:47 PM |