View Single Post
 
Old 08-28-2014, 08:26 AM
lucky16 lucky16 is offline Windows 7 32bit Office 2007
Novice
 
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, 14 views)
Reply With Quote