Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/04/2008, 07:47
iaras66
 
Fecha de Ingreso: octubre-2007
Mensajes: 36
Antigüedad: 16 años, 7 meses
Puntos: 0
Re: Abrir cualquier documento word desde VB 6.0

He probado a ponerlo asi:

'abre un documento
Me.CommonDialog1.ShowOpen
.Application.Documents.Open CommonDialog1.FileName

'final del documento
.Application.Selection.WholeStory
.Application.Selection.Copy
.Application.Selection.EndKey wdStory
'intro
.Application.Selection.TypeParagraph
'introduccion de texto
.Application.Selection.WholeStory
.Application.Selection.Copy
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader

'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

y el resultado que me da es que cuando le doy a abrir el documento deseado se atasca el programa y tengo que dar ctrol+alt+supr.

Y si le pongo solo la linea de codigo q me dices me da un error de:
"variable de tipo objecto o with no está establecida" si ndarme opción a ni siquiera elegir documento a abrir.

Sabes como se podría solucionar?? estaré poniendo algo mal!!!