'Este exemplo é um bom inicio onde vc cria a tabela insere dados faz um cálculo 'simples e imprime o conteúdo da mesma para testar pode modificar a propriedade
'visible para true e experimente pois existe a possibilidade de grandes melhoras
Option Explicit
Dim intRow As Long
Dim intTotal As Currency
Dim intTotalVAT As Currency
Dim objWord As Word.Application
Dim objDocument As Word.Document
Dim objTabela As Word.Table
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
'Aqui abre Word de forma visivel e cria documento com base
'em um documento pre-existente no diretorio desejado
Set objWord = New Word.Application
objWord.Visible = False
objWord.Documents.Add App.Path & " este.rtf", , , True
Set objDocument = objWord.ActiveDocument
'Informa o proprio documento como Range para
'montagem da tabela
Set objTabela = objDocument.Tables.Add(objDocument.Range, 1, 4)
objTabela.Columns(1).Width = objWord.InchesToPoints(2.5)
objTabela.Columns(2).Width = objWord.InchesToPoints(1.5)
objTabela.Columns(3).Width = objWord.InchesToPoints(1)
objTabela.Columns(4).Width = objWord.InchesToPoints(1)
objTabela.Cell(1, 1).Range.Text = "Descrição do Componente"
objTabela.Cell(1, 1).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleDouble
objTabela.Cell(1, 2).Range.Text = "Valor Unitário"
objTabela.Cell(1, 2).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
objTabela.Cell(1, 2).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleDouble
objTabela.Cell(1, 3).Range.Text = "Quantidade"
objTabela.Cell(1, 3).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
objTabela.Cell(1, 3).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleDouble
objTabela.Cell(1, 4).Range.Text = "Valor Total"
objTabela.Cell(1, 4).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
objTabela.Cell(1, 4).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleDouble
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Dim nTot As Currency
intRow = intRow + 1
objTabela.Rows.Add
objTabela.Cell(intRow, 1).Range.Text = Text1
objTabela.Cell(intRow, 1).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleNone
objTabela.Cell(intRow, 2).Range.Text = Text2
objTabela.Cell(intRow, 2).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleNone
objTabela.Cell(intRow, 3).Range.Text = Text3
objTabela.Cell(intRow, 3).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleNone
nTot = Format$(Text2 * Text3, "0##,0##.##")
objTabela.Cell(intRow, 4).Range.Text = nTot
objTabela.Cell(intRow, 4).Range.ParagraphFormat.Borders.OutsideLineStyle = wdLineStyleNone
End Sub
Private Sub Command3_Click()
objWord.ActiveDocument.PrintOut
Do While objWord.BackgroundPrintingStatus > 0
Sleep 250
Loop
End Sub
Private Sub Form_Load()
Command2.Enabled = False
intRow = 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set objTabela = Nothing
objWord.Quit wdDoNotSaveChanges
End Sub