I am attempting to export an array from Excel into a Word table.
I have included my code below, I get a new instance of word but that's where it ends?
Can anyone confirm what I have missed...
Dim objWord As Object
Set objWord = New Word.Application
objWord.Visible = True
objWord.Documents.Add
objWord.EndKey Unit:=wdStory
objWord.TypeParagraph
ActiveDocument.Tables.Add Range:=Selection.Range, numrows:=1, numcolumns:= 9,_ DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitContent
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
Selection.Tables(1).Select
Selection.SelectCell
Selection.TypeText Text:="Contract #"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Narrative 1"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Narrative 2"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="St Date"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Fi Date"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Contract Type"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Budget Sale"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Actual Sale"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Balance"
<not included array loop, any help here would be an advantage to this new recruit..
Thank you...
I have included my code below, I get a new instance of word but that's where it ends?
Can anyone confirm what I have missed...
Dim objWord As Object
Set objWord = New Word.Application
objWord.Visible = True
objWord.Documents.Add
objWord.EndKey Unit:=wdStory
objWord.TypeParagraph
ActiveDocument.Tables.Add Range:=Selection.Range, numrows:=1, numcolumns:= 9,_ DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitContent
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
Selection.Tables(1).Select
Selection.SelectCell
Selection.TypeText Text:="Contract #"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Narrative 1"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Narrative 2"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="St Date"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Fi Date"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Contract Type"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Budget Sale"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Actual Sale"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Balance"
<not included array loop, any help here would be an advantage to this new recruit..
Thank you...