suddenly experiencing error messages with table macro
Hi Tom,
There's no logical reason why the macro would work with one set of styles and
not another - unless the errant one refers to a non-existent style. Are you
sure it's "Reftable Flush" and not "ReftableFlush", for example?
As an aside, you could combine the two macros into one, with an 'ElseIf for
the second style.
Cheers
--
macropod
[MVP - Microsoft Word]
"Tom" wrote in message
oups.com...
| I can't quite get it to work. I have two table macros working, and one
| of them always gets stuck on the following line:
|
| .Range.Paragraphs(1).Style = ActiveDocument.Styles("Reftable Flush")
|
| I've triple checked to make sure what I have a Reftable Flush style. It
| is a table style, but I didn't think that mattered. Is there anything
| else I can try?
|
| Here are the two macros:
|
| Sub ConvertRefTables2()
| Dim oTbl As Table
| For Each oTbl In ActiveDocument.Tables
| If oTbl.Cell(1, 1).Range.Paragraphs(1).Style = _
| ActiveDocument.Styles("Table Header") Then
| With oTbl
| .Range.Paragraphs(1).Style =
| ActiveDocument.Styles("Reftable")
| .PreferredWidthType = wdPreferredWidthPercent
| .PreferredWidth = 75
| End With
| End If
| Next oTbl
| End Sub
|
| Sub ConvertRefTablesFlush2()
| Dim oTbl As Table
| For Each oTbl In ActiveDocument.Tables
| If oTbl.Cell(1, 1).Range.Paragraphs(1).Style = _
| ActiveDocument.Styles("Table Header Flush") Then
| With oTbl
| .Range.Paragraphs(1).Style =
| ActiveDocument.Styles("Reftable Flush")
| .PreferredWidthType = wdPreferredWidthPercent
| .PreferredWidth = 83
| End With
| End If
| Next oTbl
| End Sub
|
| I don't know why, but every time I
|
|