| |||
¿porque desaparece la informacion? hola a todos, espero esten bien, mi duda es la siguiente, estoy realizando una aplicacion en VB6.0 y Access en formato 97 y en un datalist muestro informacion de un campo, pero al presionar un boton que me habre un doc. de word desaparece la informacion, quisiera saber si alguien me puede ayudar, de antemano agradezco la ayuda que me puedan dar, un saludo a todos!!! |
| ||||
![]() ¿Qué código tienes para abrir el Word?
__________________ Por favor, antes de preguntar, revisa la Guía para realizar preguntas. |
| |||
Respuesta: ¿porque desaparece la informacion? Este es el codigo para abrir Word: Private Sub ButtonMac2_Click() Dim sql, sql2 As String Dim asignados As Double Dim resp If Text13.Text = "" Then x = MsgBox("No se ingresó ninguna clave, el campo es obligatorio, Vease Manual de Errores", vbCritical, "Error 002") Text13.SetFocus Else Adodc1.RecordSource = "SELECT presproy.id_proy FROM presasig, presproy WHERE presasig.id = " & Val(Text13.Text) & " AND presasig.id = presproy.id_presasig" Adodc1.Refresh Adodc1.RecordSource = "SELECT asig FROM soli WHERE id_proye = " & Val(Text22.Text) & " AND carr = '" & Text5.Text & "'" Adodc1.Refresh asignados = Adodc1.Recordset.Fields("asig") asignados = asignados - 1 Call conectar sql = "UPDATE soli SET asig = " & asignados & " WHERE id_proye = " & Val(Text22.Text) & " AND carr = '" & Text5.Text & "'" con.Execute sql con.Close resp = "ON" Call conectar sql2 = "UPDATE presasig SET concluyo = " & resp & " WHERE id = " & Val(Text13.Text) & "" con.Execute sql2 con.Close x = MsgBox("Concluyó su Servicio Social", vbOKOnly, "Baja") Call InformacionTerminoSocial 'linea para abrir word End If End Sub |
| ||||
![]() Pero no pusiste el contenido de la función para abrir el Word, que se llama InformacionTerminoSocial.
__________________ Por favor, antes de preguntar, revisa la Guía para realizar preguntas. |
| |||
Respuesta: ¿porque desaparece la informacion? TIENES RAZON, PERDON, ESTA ES LA FUNCION: Public Sub InformacionTerminoSocial() Dim TITULO As String Dim Info As String 'variables para guardar el texto Dim Info2 As String TITULO = " CARTA DE TÉRMINO" & vbCrLf & "" Info = " " & frmCartaTerminoSocial.Text1.Text & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & frmCartaTerminoSocial.Text2.Text & vbCrLf & vbCrLf & frmCartaTerminoSocial.Text3.Text & vbCrLf & frmCartaTerminoSocial.Text16.Text & vbCrLf & frmCartaTerminoSocial.Text17.Text & vbCrLf & frmCartaTerminoSocial.Text18.Text & vbCrLf & "Presente.-" & vbCrLf & vbCrLf & "Se hace constar que: " & frmCartaTerminoSocial.Text4.Text & vbCrLf & "Alumno(a) de esa Institución Educativa de la carrera de " & frmCartaTerminoSocial.Text5.Text & " con cuenta escolar " & frmCartaTerminoSocial.Text6.Text & " realizó satisfactoriamente la prestación de su(s) " & frmCartaTerminoSocial.Text7.Text & " del " & frmCartaTerminoSocial.Text8.Text & " al " & frmCartaTerminoSocial.Text9.Text & " en el Área Usuaria: " & frmCartaTerminoSocial.Text10.Text & " con horario de " & frmCartaTerminoSocial.Text12.Text & "" Info2 = "cubriendo un total de " & frmCartaTerminoSocial.Text14.Text & "horas, y desarrolló las siguientes actividades: " & frmCartaTerminoSocial.DataList1.Text & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "y bajo la asesoría de " & frmCartaTerminoSocial.Text21.Text & vbCrLf & vbCrLf & "Lo que comunico a usted para los efectos legales y administrativos a que haya lugar." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & " " & frmCartaTerminoSocial.Text19.Text & vbCrLf & " " & frmCartaTerminoSocial.Text15.Text & " " & frmCartaTerminoSocial.Text20.Text & "" Call GenerarArchivo2(TITULO, Info, Info2) End Sub Y ESTO TAMBIEN: Public Sub GenerarArchivo2(TITULO As String, Info As String, Info2 As String) Dim MSWord As New Word.Application 'se declara vairable del tipo word Dim Documento As Word.Document 'se declara variable de tipo documento de word Dim Parrafo As Paragraph 'se declara variable de tipo parrafo Set MSWord = CreateObject("Word.Application") ' se crean objetos Set Documento = MSWord.Documents.Add Set Parrafo = Documento.Paragraphs.Add Clipboard.Clear 'se limpia portapapeles de office Clipboard.SetData frmCartaTerminoSocial.Picture1.Picture 'se pone la imagen en el portapapeles MSWord.Selection.Paste 'primero pegamos la imagen Clipboard.Clear 'limpiamos portapapeles Clipboard.SetData frmCartaTerminoSocial.Picture2.Picture 'se pone la imagen en el portapapeles MSWord.Selection.Paste 'primero pegamos la imagen Clipboard.Clear 'limpiamos portapapeles Parrafo.Range.InsertAfter TITULO & vbCrLf & Info & vbCrLf & Info2 'insertamos las variables con en texto" MSWord.Visible = True 'abrimos el archivo End Sub |