Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2014, 04:39 AM
macropod's Avatar
macropod macropod is offline Call value from previous form field Windows 7 32bit Call value from previous form field Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
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

First, you would need to create each of your dependent dropdown content controls, each in its own paragraph. Then you would create a custom Quick Part from each of those paragraphs (see http://office.microsoft.com/en-us/wo...010370568.aspx). Next, you'd delete those from the document and create the dropdown you'll use to choose the various options. Then, insert a continuous Section break immediately before where the dependent dropdown is to be inserted. Finally, you'd add a macro to the document's 'ThisDocument' module, coded along the lines of:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim StrNm As String
With ContentControl
  If .Title <> "Dropdown 1" Then Exit Sub
  Select Case .Range.Text
    Case "Item 1": StrNm = "Fruit"
    Case "Item 2": StrNm = "Game"
    Case Else: StrNm = ""
  End Select
End With
With ActiveDocument.Sections(2).Range.ContentControls(1)
  .LockContentControl = False
  .Delete
End With
If StrNm = "" Then Exit Sub
Application.Templates("C:\Users\" & Environ("UserName") & _
  "\Documents\Misc\Office Config\Word\Normal.dotm"). _
  BuildingBlockEntries(StrNm).Insert RichText:=True, _
  Where:=ActiveDocument.Sections(2).Range.Characters.First
End Sub
where:
• "Dropdown 1" is the title property of the master dropdown
• "Item 1" & "Item 2" are the master dropdown entry names
• "Fruit" & "Game" are the corresponding custom Quick Part names.
• the custom Quick Parts are stored in Word's 'Normal' template.
• the target Section is Section 2.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 01-29-2014, 05:51 PM
adamthepolak adamthepolak is offline Call value from previous form field Windows 7 64bit Call value from previous form field Office 2013
Novice
Call value from previous form field
 
Join Date: Jan 2014
Posts: 7
adamthepolak is on a distinguished road
Default

thanks for the answer, but which part of the code addresses the issue of calling back to the previous value from cell A1 if A2 is blank?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Call value from previous form field Form field selection allows entry into form text box David C Word 1 10-24-2012 04:53 AM
Call value from previous form field Can't tab from field to field in form Lynieee Word 6 06-18-2012 02:37 PM
Word form field JBaker Word 18 03-22-2012 09:05 AM
Call value from previous form field Form Fields - Create blank form text field with if statement? LAssist2011 Word 5 12-14-2011 03:02 PM
Form Field Shading. Ninerhoss Word 0 11-23-2010 02:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:50 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