Following is killing me:Sub
Set oWord = CreateObject(“Word.Application”)
oWord.Visible = True
Set oDocument = oWord.Documents.Add()
REM Create Table1
Set range = oWord.Selection.Range
Set table1 = oWord.selection.Tables.Add(range,5,2)
table1.Borders.Enable = False
oDocument.Tables(1).Cell(1, 1).Range.InsertBefore (“BILL TO”)
REM Move Cursor out of the Table
For x= 1 To 5
oWord.Selection.MoveDown
Next
With oWord.Selection
.MoveDown
.InsertParagraph
End With
REM Create Table2
Set MyRange = table1.Range
With MyRange
.Collapse 0
.Move(1)
.Select
End With
Set table2 = oDocument.Tables.Add(MyRange, 3, 2)
table2.Borders.Enable = False
table2.Cell(1, 1).width = 120
table2.Cell(1, 1).Range.Text = “Shipping Method”
REM Move Cursor out of the Table
For x= 1 To 3
oWord.Selection.MoveDown
Next
With oWord.Selection
.MoveDown
.InsertParagraph
End With
REM Create Table3
Set MyRange = table2.Range
With MyRange
.Collapse 0
.Move(1)
.Select
End With
Set table3 = oDocument.Tables.Add(MyRange, 1, 4)
table3.Borders.Enable = False
table3.Cell(1, 1).width = 60
table3.Cell(1, 1).Range.Text = “Cust. No”
table3.Cell(1, 2).width = 100
table3.Cell(1, 2).Range.Text = “Purchase Order”
table3.Cell(1, 3).width = 100
table3.Cell(1, 3).Range.Text = “Sales Person”
table3.Cell(1, 4).width = 100
table3.Cell(1, 4).Range.Text = “Order Date”
REM I WANT CELL(1, 2) TO BE CENTRIFIED
Set MyRange = table3.Range
MyRange.Tables(1).Columns(2).Select
Selection.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
END
Last Statement does not work!!!
What am I doing wrong?
Please, Help.
Thanks in advance