View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default suddenly experiencing error messages with table macro

I discovered what was wrong. Some of my tables have two different kinds
of styles in cell(1,1). That's why the macro was working before, but
then suddenly threw error messages at me -- because previously, all my
tables had only one style.

How do I modify the following macro so that I can allow more than one
style in Cell(1,1)? In other words, how can I write an Or statement in
there -- like If (1,1) has Table Header style or Image style or Figure
Caption style, then ....

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