Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-26-2014, 10:29 AM
lucky16 lucky16 is offline Conditional Outputs from Content Control Dropowns Windows 7 32bit Conditional Outputs from Content Control Dropowns Office 2007
Novice
Conditional Outputs from Content Control Dropowns
 
Join Date: Jan 2014
Posts: 21
lucky16 is on a distinguished road
Default Conditional Outputs from Content Control Dropowns

Hi Paul,

I have a similar situation to https://www.msofficeforums.com/word-...own-lists.html, where i need to place dropdowns in four different parts of the document. Please see the attached screenshot.



Do i need to use frames in order to achieve this?
If frames are to be used, what code should be used to place drop downs in it.

Can you please help me with an example. I've been searching for this from long time, but could not find anything on how to get this work.

Thanks
Laxman
Attached Images
File Type: png Screenshot.png (26.9 KB, 62 views)
Reply With Quote
  #2  
Old 08-26-2014, 03:34 PM
macropod's Avatar
macropod macropod is offline Conditional Outputs from Content Control Dropowns Windows 7 64bit Conditional Outputs from Content Control Dropowns Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Post #9 of that thread contains the information you need for adding extra sets. And no, you don't need frames.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 08-27-2014, 10:46 AM
lucky16 lucky16 is offline Conditional Outputs from Content Control Dropowns Windows 7 32bit Conditional Outputs from Content Control Dropowns Office 2007
Novice
Conditional Outputs from Content Control Dropowns
 
Join Date: Jan 2014
Posts: 21
lucky16 is on a distinguished road
Default

Hi,

I've Tried using the following code. But it is returning Run time error. Please see attached screen of error.

Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  If .Title = "Name" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
      Exit For
    End If
  Next
  ActiveDocument.SelectContentControlsByTitle("Details").Item(1).Range.Text = StrDetails
  End If
  End With
End Sub

My document is not protected. And i don't understand why i am getting this error. Could you please tell how to fix this?

Thanks
Laxman
Attached Images
File Type: jpg Capture.JPG (105.0 KB, 60 views)
Reply With Quote
  #4  
Old 08-27-2014, 03:12 PM
macropod's Avatar
macropod macropod is offline Conditional Outputs from Content Control Dropowns Windows 7 64bit Conditional Outputs from Content Control Dropowns Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

You have probably locked the 'Details' control against editing.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 08-27-2014, 06:59 PM
lucky16 lucky16 is offline Conditional Outputs from Content Control Dropowns Windows 7 32bit Conditional Outputs from Content Control Dropowns Office 2007
Novice
Conditional Outputs from Content Control Dropowns
 
Join Date: Jan 2014
Posts: 21
lucky16 is on a distinguished road
Default

How to unlock To get rid of this error.
Reply With Quote
  #6  
Old 08-27-2014, 08:32 PM
macropod's Avatar
macropod macropod is offline Conditional Outputs from Content Control Dropowns Windows 7 64bit Conditional Outputs from Content Control Dropowns Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Check it's properties! Click on the control, then choose Developer>Controls>Properties
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 08-28-2014, 08:26 AM
lucky16 lucky16 is offline Conditional Outputs from Content Control Dropowns Windows 7 32bit Conditional Outputs from Content Control Dropowns Office 2007
Novice
Conditional Outputs from Content Control Dropowns
 
Join Date: Jan 2014
Posts: 21
lucky16 is on a distinguished road
Default

In properties of content control, the lock option was already unchecked. Still getting this run time error.
I've attached the word document and code below. Can you please have a look.
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  If .Title = "Name1" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
      Exit For
    End If
  Next
  ActiveDocument.SelectContentControlsByTitle("Details1").Item(1).Range.Text = StrDetails
  End If
  
  If .Title = "Name2" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
      Exit For
    End If
  Next
  ActiveDocument.SelectContentControlsByTitle("Details2").Item(1).Range.Text = StrDetails
  End If
  
  End With
End Sub
Thanks
Laxman
Attached Files
File Type: docx Doc1.docx (21.2 KB, 12 views)
Reply With Quote
  #8  
Old 08-28-2014, 04:21 PM
macropod's Avatar
macropod macropod is offline Conditional Outputs from Content Control Dropowns Windows 7 64bit Conditional Outputs from Content Control Dropowns Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

The reason you're getting the error is that you're using a dropdown content control for the output. You would get better results if you didn't go using different controls from what the sample uses... Use a text content control for the output.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Outputs from Content Control Dropowns Clicking the selected Content Control checkbox returns wrong control in vba event DougsGraphics Word VBA 2 06-24-2015 07:31 AM
Conditional Outputs from Content Control Dropowns Assign a value to a Content Control SuzeG Word VBA 10 12-08-2013 08:04 AM
Conditional Outputs from Content Control Dropowns Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM
Conditional Outputs from Content Control Dropowns Content control problem Anja Word 2 10-16-2013 09:56 AM
Retrieving content control value jillapass Word VBA 4 05-24-2012 05:07 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:46 AM.


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