Thread: [Solved] Table won't create
View Single Post
 
Old 02-23-2017, 10:20 AM
Souriane Souriane is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: Feb 2017
Location: Quebec, Canada
Posts: 82
Souriane is on a distinguished road
Default

Hi,

I would modify you code this way :

Code:
ActiveDocument.Bookmarks("Table_5").Select
ActiveDocument.Tables.add Range:=Selection.Range, NumRows:=2, NumColumns:= _
3, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = False
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = False
.ApplyStyleRowBands = True
.ApplyStyleColumnBands = False
End With

Selection.TypeText Text:="Due Date"
Selection.MoveRight unit:=wdCell
Selection.TypeText Text:="Staff Name"
Selection.MoveRight unit:=wdCell
Selection.TypeText Text:="Supervisor"
Selection.MoveRight unit:=wdCell
I took the wdApp off in front of "ActiveDocument".

Bye!

Souriane
Reply With Quote