
09/04/2008, 10:09
|
| | Fecha de Ingreso: octubre-2007
Mensajes: 36
Antigüedad: 17 años, 6 meses Puntos: 0 | |
Re: Copiar y pegar todo el texto de un Word a otro mediante visual basic 6.0 Bueno resulta que no tiene que habrir por cada numero de cuestionario y pegar en el nuevo word los datos; si no que tienen que ir pegandose en el mismo documento.
Le he quitado la parte de código que habre un nuevo word para pegar en el los datos y se queda asi:
.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
.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" + " " & numinicio
numinicioval = numinicio + 1
For i = numinicioval To numfinal
.Selection.WholeStory
.Selection.Copy
.Selection.PasteAndFormat (wdPasteDefault)
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
'Para que en todos los encabezados sean iguales
'Para alinear el texto a la derecha
.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
Documento.Selection.Font.Name = "Times News Roman"
Documento.Selection.Font.Size = 11
.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
'mostramos documento
.Application.Visible = True
End With
Set oword = Nothing
Set Documento = Nothing
El fallo que me da es un mensaje que no puede insertar saltos de edicion en encabezados ni pies.
Existe algún código que haga que sepueda ir al final de la ultima hoja del documento para que se peguen ahí los datos??
Gracias!!! |