View Single Post
 
Old 03-06-2014, 12:37 PM
SuzeG SuzeG is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Dec 2013
Location: Va Beach
Posts: 21
SuzeG is on a distinguished road
Unhappy VBA Run time error '91' suspect .placeholdertext=nothing

I have created a form with multiple tables.
When it gets to this part of the code I get

Run Time Error '91'
Object variable or with block not set

I believe it is because the .placeholdertext = nothing

How can I fix this?

Thank you in advance
Code:
 
With ActiveDocument.Tables(6)
  If ContentControl.Range.InRange(.Range) Then
    For i = 3 To .Rows.Count
      With .Cell(i, 2).Range.ContentControls(1)
        If .Range.Text <> .PlaceholderText Then
          k = k + 1
          For j = 1 To .DropdownListEntries.Count
            If .DropdownListEntries(j) = .Range.Text Then
              l = l + .DropdownListEntries(j).Value
              Exit For
            End If
          Next
        End If
        i = i + 1
      End With
    Next
    With ActiveDocument.Tables(1).Rows.Last.Cells(1).Range
       If k > 0 Then
        .Text = Format(l, "##0")
       Else
         .Text = vbNullString
       End If
     End With
  End If
End With
Reply With Quote