Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-26-2020, 01:16 PM
gmaxey gmaxey is offline Modifying Next Paragraph Based on Dropdown Selected Windows 10 Modifying Next Paragraph Based on Dropdown Selected Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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.
Attached Images
File Type: jpg CXMLPart.jpg (29.8 KB, 32 views)
Attached Files
File Type: docm Form example.docm (73.1 KB, 7 views)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #2  
Old 04-26-2020, 03:32 PM
macropod's Avatar
macropod macropod is offline Modifying Next Paragraph Based on Dropdown Selected Windows 7 64bit Modifying Next Paragraph Based on Dropdown Selected Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by gmaxey View Post
Paul, downloaded the document from your link and nothing happens when I change the FF DDL. I may be missing something.
Did you exit the formfield via the TAB key after updating it?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
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
Modifying Next Paragraph Based on Dropdown Selected Assign selected value from DropDown to a variable jhansrod Word VBA 3 06-13-2019 04:46 PM
Modifying Next Paragraph Based on Dropdown Selected Modifying Paragraph Spacing Issue 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft