Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding a row to a table in word documento from vb6

Status
Not open for further replies.

ale15926

Programmer
Feb 16, 2005
1
VE
hi,

I'm a java developer and i'm kind of confused with vb6, it's a small project that needs to generate a report from a form already filled with the data... i'm using this:

Dim aplicacion As Word.Application
Dim documento As Word.Document
Dim tabla As Word.Table
Set aplicacion = CreateObject("Word.Application")
Set documento = aplicacion.Documents.Add("C:\CNAC Contact Manager\Reportes\ReporteUsuarios.dot")
Set tabla = documento.Tables(1)
Dim index As Integer 'el indice para el while
i = 2
'lleno el template
While Me.buscarUsuariosBD.Recordset.EOF = False
With tabla
.Cell(i, 1).Range.Text = Me.buscarUsuariosBD.Recordset!nacionalidad
.Cell(i, 2).Range.Text = Me.buscarUsuariosBD.Recordset!cedula
.Cell(i, 3).Range.Text = Me.buscarUsuariosBD.Recordset!nombre
.Cell(i, 4).Range.Text = Me.buscarUsuariosBD.Recordset!apellido
.Cell(i, 5).Range.Text = Me.buscarUsuariosBD.Recordset!Usuario
.Cell(i, 6).Range.Text = Me.buscarUsuariosBD.Recordset!descripcion
Me.buscarUsuariosBD.Recordset.MoveNext
i = i + 1
End With
Wend

but I ran out of rows in my table, HOW DO I ADD A NEW ROW TO THE TABLE???? I appreciate your help
 
I have done this before, but I did not use the Table object to populate the table so it may not work in this case.

Select the last field on the table.

Then try a

MoveRight wdCell

Mimics what word does when you press TAB on the last Cell of a table.

Hope this helps.

Hammy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top