0

He logrado pasar un dato seleccionado del Listbox1 de un Form1 a un Textbox1 de un Form2 con el siguiente código:

Private Sub btnModificar_Click()
If Me.Listbox1.ListIndex < 0 Then
    MsgBox "No se ha elegido ningún registro",
Else
   Dim DATO As String, I As Integer
        DATO = Listbox1.Text
        I = Listbox1.ListIndex
        If Listbox1.ListIndex >= 0 Then
        UserForm2.Textbox1.Text = DATO
        End If

   UserForm2.Show
End If
End Sub

Sin embargo; mi problema es que cuando puse el Initialize en el UseForm2

Private Sub UserForm2_Initialize()
End Sub

me aparece el Error de "Se requiere un objeto", que puedo hacer?

2
  • ¿Qué linea te destaca cuando da el error? De todas formas, quizás deberías llevarte el valor de DATO a una variable pública y entonces cargarlo en el USerform2
    – Esei
    el 30 dic. 2018 a las 3:49
  • probaré con la variable publica gracias el 31 dic. 2018 a las 14:49

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.