I have an Access db that outputs a table (from a query) to MS Word in RFT format. I've made 3 macros to apply to the table. The first one saves it as a macro enable compatibility doc (docm). The next macro changes the font in the whole table to Times NR 10. These two work great. The third macro tries to adjust the column widths but I get the following error:
Run-time error '4605'
The SelectColumn method or property is not available because some or all of the object does not refer to a table.
I am using the Layout tab to select the table, then the properties, then column widths to record the macro but it's not working.
Here is the macro as recorded:
Sub MTL_MacroColumns()
'
' MTL_MacroColumns Macro
' Changes column widths
'
Selection.Tables(1).Select
Selection.Columns.PreferredWidthType = wdPreferredWidthAuto
Selection.Columns.PreferredWidth = 0
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(1)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(3.32)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.69)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.9)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.9)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.69)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
End Sub
Anybody have any ideas?
Run-time error '4605'
The SelectColumn method or property is not available because some or all of the object does not refer to a table.
I am using the Layout tab to select the table, then the properties, then column widths to record the macro but it's not working.
Here is the macro as recorded:
Sub MTL_MacroColumns()
'
' MTL_MacroColumns Macro
' Changes column widths
'
Selection.Tables(1).Select
Selection.Columns.PreferredWidthType = wdPreferredWidthAuto
Selection.Columns.PreferredWidth = 0
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(1)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(3.32)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.69)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.9)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.9)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.69)
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
End Sub
Anybody have any ideas?