elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Temas
Páginas: [1]
1  Programación / Programación Visual Basic / Ayuda formulario para insertar fila a una tabla word con VBA en: 8 Febrero 2016, 17:23 pm
Hola.
Es la primera vez que entro y os mando un saludo. A ver si me pueden ayudar.

 Tengo un formulario en el que se crea una tabla la cual quiero ir insertando filas según vaya necesitando mediante un botón de comando. Cuando relleno el formulario e intento insertar una fila me falla diciendo: "se ha producido un error '4605' en tiempo de ejecución: todo o parte del objeto no hace referencia a una tabla. Este método o propiedad no está disponible porque" al darle "Depurar" me sale en amarillo
Citar
Selection.InsertRowsBelow 1
.
Si relleno el formulario y no le doy a insertar fila y me salgo del formulario y vuelvo a entrar sí me deja insertar fila sin problemas y cuantas desee. Así que yo creo que el problema es que si no ha creado la tabla físicamente no puede insertar filas. Necesito alguna idea para que pueda insertar filas sin salir del formulario ya que puedo seguir rellenando el siguiente.
Dejo los códigos que he metido en el botón de comando

Citar
Private Sub CommandButton7_Click()
 With Selection
 Selection.EndKey Unit:=wdLine
 Selection.MoveRight Unit:=wdCharacter, Count:=2
 Selection.InsertRowsBelow 1
 Selection.HomeKey Unit:=wdRow
 Selection.EndKey Unit:=wdColumn
 Selection.TypeText Text:=TextBox13.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox14.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox15.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox16.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox17.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox18.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox19.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox20.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 Selection.TypeText Text:=TextBox21.Text
 TextBox13.Text = ""
 TextBox14.Text = ""
 TextBox15.Text = ""
 TextBox16.Text = ""
 TextBox17.Text = ""
 TextBox18.Text = ""
 TextBox19.Text = ""
 TextBox20.Text = ""
 TextBox21.Text = ""

 End With
 End Sub


Si fuera necesario algún dato más me dicen.
Un saludo
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines