¿Exportar datos de excel a word por columnas?

Para exportar a word un trabajo en excel coloque el siguiente código

sub ExportarDeExcelAWord()
Dim oAplicacionWord As Word.Application
Dim oDocumento As Word.Document

Set oAplicacionWord = New Word.Application
Set oDocumento = oAplicacionWord.Documents.Add()

Dim textoActualCelda As String

For contador = 1 To Cells.SpecialCells(xlCellTypeLastCell).Row

textoActualCelda = textoActualCelda & "" & Cells(contador, 1)

Next Contador

oDocumento.Content.InsertAfter (textoActualCelda)
oAplicacionWord.Visible = True

Set oDocumento = Nothing
Set oAplicacionWord = Nothing
End Sub

Podrían colaborarme por favor, para exportar la información, pero que en la hoja de word la misma se muestre por columnas ej

1. Jjjjjjjjjjjjjjjjjjjjjjjjjjjj       2.jjjjjjjjjjjjjjjjjjjjjjjjjj    3. Jjjjjjjjjjjjjjjjjjjjjjj

4. Jjjjjjjjjjjjjjjjjjjjjjjjjjj        5. Jjjjjjjjjjjjjjjjjjjjjjjj     6. Jjjjjjjjjjjjjjjjjjjjjj

7. Jjjjjjjjjjjjjjjjjjjjjjjjjj         8. Jjjjjjjjjjjjjjjjjjjjjjj      9. Jjjjjjjjjjjjjjjjjjjjjj

1 Respuesta

Respuesta
1

Te comparto este código que utilizo para un generar una carta en Word, a diferencia del tuyo es que yo trabajo en Word y traigo los datos desde Excel; es una tabla insertada en Word y los datos se insertan en la columna 2, espero te sirva.

For Each acell In ActiveDocument.Tables(1).Columns(2).Cells 
          acell.Range.Text = obj_excel.ActiveCell.Value    
          obj_excel.ActiveCell.Offset(0, 1).Activate
Next acell

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas