suddenly experiencing error messages with table macro
My document was running the following macro without any problems:
Sub ConvertRefTables()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
If oTbl.Cell(1, 1).Range.Style = _
ActiveDocument.Styles("Table Header") Then
With oTbl
.Style = ActiveDocument.Styles("Reftable")
.PreferredWidthType = wdPreferredWidthPercent
.PreferredWidth = 75
End With
End If
Next oTbl
End Sub
However, when I run it now, I receive an error message that says
"Object variable or with block variable not set." And it highlights
this part of the macro code:
If oTbl.Cell(1, 1).Range.Style = _
ActiveDocument.Styles("Table Header") Then
My document does have a table with the Table Header style is cell
(1,1), so I'm not sure why I'm getting the error.
I am running the macro with other macros in the document -- maybe
that's the problem? I copied the macro into a new document and it
worked fine. It's just when I include it with the other macros that it
starts to give me with error message. Can anyone help me?
Thanks,
Tom
|