Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/04/2008, 04:29
iaras66
 
Fecha de Ingreso: octubre-2007
Mensajes: 36
Antigüedad: 16 años, 7 meses
Puntos: 0
Re: Copiar y pegar todo el texto de un Word a otro mediante visual basic 6.0

Ya consigo pegarlo!!! Pero como tendría q hacer por ejemplo para pasar unas variables a este nuevo documento??? Es decir que me ejecute un for en el nuevo en el q pego todo

Te pongo el código:

.Application.Selection.TypeText "Nº Cuestionario" + " " & numinicio
.Selection.WholeStory
.Selection.Copy
Set oword = CreateObject("Word.Application")
oword.Visible = True
Set oDoc = oword.Documents.Add
.Selection.PasteAndFormat (wdPasteDefault)
numinicioval = numinicio + 1
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
'Para que en todos los encabezados sea igual

'Para alinear el texto a la derecha



.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
Documento.Selection.Font.Name = "Times News Roman"
Documento.Selection.Font.Size = 11

For i = numinicioval To numfinal
.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
.Application.Selection.TypeText "Nº Página" & vbNewLine

.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
Documento.Selection.Sections(1).Headers(1).PageNum bers.Add PageNumberAlignment:= _
wdAlignPageNumberRight, FirstPage:=True


Documento.Selection.Font.Name = "Times News Roman"
Documento.Selection.Font.Size = 11
With Selection.ParagraphFormat

.RightIndent = CentimetersToPoints(0.11)
.SpaceBeforeAuto = False
.SpaceAfterAuto = False

End With
.Application.Selection.TypeText "Nº Cuestionario" + " " & i
Next i

Aqui lo q pretendo es q en el encabezado me ponga el primer valor de un textbox y que cuando copiemos/pegemos todo en un word nuevo siga ejecutando el For en os nuevos documentos que se originen.
El problema es q los resultados de ese For solo me aparecen en el primer documento y no en los demás.

Algún consejo???