Run-Time Error 4605

G

Greg Maxey

I have a working template (works on my PC with Word2007 and Word2003), works
on a clients PC (both versions) works on many PCs of my clients client, but
generates a runtime error 4605 on one of her clients machines.

The exact error is "Run-Time error '4605' The Height method or property is
not available because some or all of the object does not refer to a table."

The template presents a userform where the user can insert up to four
addressees each with an optional delivery method statement. The userfrom
information is then placed in a 5 X 2 table. Depending on the combination of
addreessees and DM statements rows 1, 3, and 4 may not be unused. To
eliminate white space the code sets theses unused rows to "Height" 1pt.
The code is as follows. There error occurs on the line:

..Rows(3).Height = 1

'Build recipients data
With recTable
If Trim(txtRec4.Text) <> "" Then
With .Cell(4, 2).Range
.Text = txtRec4.Text
.Font.Bold = False
End With
If cmbAdd4Delivery.ListIndex > -1 Then
With .Cell(3, 2).Range
.Text = cmbAdd4Delivery.Value
.Font.Bold = True
.Font.Underline = wdUnderlineSingle
End With
End If
End If
If Trim(txtRec3.Text) <> "" Then
With .Cell(4, 1).Range
.Text = txtRec3.Text
.Font.Bold = False
End With
If cmbAdd3Delivery.ListIndex > -1 Then
With .Cell(3, 1).Range
.Text = cmbAdd3Delivery.Value
.Font.Bold = True
.Font.Underline = wdUnderlineSingle
End With
Else
With .Cell(3, 2).Range
.ParagraphFormat.SpaceBefore = 0
End With
With .Cell(3, 1).Range
.ParagraphFormat.SpaceBefore = 0
End With
End If
Else
.Rows(3).Height = 1
.Rows(3).HeightRule = wdRowHeightExactly
.Rows(4).Height = 1
.Rows(4).HeightRule = wdRowHeightExactly
End If
If Trim(txtRec1.Text) <> "" Then
With .Cell(2, 1)
.Range.Text = txtRec1.Text
.Range.Font.Bold = False
End With
Else
Set oRng = recTable.Cell(2, 1).Range
oRng.Collapse
End If
If Trim(txtRec2.Text) <> "" Then
oDoc.Variables("MultiRec").Value = "True"
With .Cell(2, 2)
.Range.Text = txtRec2.Text
.Range.Font.Bold = False
End With
End If
If cmbAdd1Delivery.ListIndex > -1 Then
With .Cell(1, 1)
.Range.Text = cmbAdd1Delivery.Value
.Range.Font.Bold = True
.Range.Font.Underline = wdUnderlineSingle
End With
End If
If cmbAdd2Delivery.ListIndex > -1 Then
With .Cell(1, 2)
.Range.Text = cmbAdd2Delivery.Value
.Range.Font.Bold = True
.Range.Font.Underline = wdUnderlineSingle
End With
End If
If cmbAdd1Delivery.ListIndex = -1 And cmbAdd2Delivery.ListIndex = -1 Then
.Rows(1).Height = 1
.Rows(1).HeightRule = wdRowHeightExactly
End If
With .Rows.Last
.Cells(2).Range.Select
End With
End With

Has anyone seen this before? Any ideas? Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top