RE:Agregar marcadores en documento Word mediante V
Hola, he introduciod esta parte de còdigo en un Commandbutton pero no me introduce ningún marcador al documento Word.
Tego implementado el siguiente código:
Private Sub Command1_Click()
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Marcador3"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
End Sub
Private Sub Form_Load()
Dim Documento As New Word.Application
With Documento
'abre un documento
.Application.Documents.Open App.Path & "ejemplo.doc"
'relleno de marcadores
.Documents.Item(1).Bookmarks.Item("Marcador1").Range.Text = "TITULO"
.Documents.Item(1).Bookmarks.Item("Marcador2").Range.Text = "OTRO TEXTO"
'final del documento
.Application.Selection.EndKey wdStory
'intro
.Application.Selection.TypeParagraph
'introduccion de texto
.Application.Selection.TypeText "Ejemplo de prueba"
'intro
.Application.Selection.TypeParagraph
.Application.Selection.TypeParagraph
.Application.Selection.TypeParagraph
'crear tabla
.Documents.Item(1).Tables.Add Documento.Application.Selection.Range, 3, 5
'relleno de tabla
.Documents.Item(1).Tables(1).Cell(1, 1).Range.Text = "Celda 1"
'mostramos documento
.Application.Visible = True
End With
Set Documento = Nothing
End Sub
La cuestion es para introducir unos marcadores y luego en ellos el texto que desees.
Si por ejemplo querria introducir en el marcador los datos de un Textbox del formulario como tendría q hacer???
¡¡¡GRACIAS!!!