Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: leliCabello en 3 Diciembre 2010, 02:07 am



Título: Error con con visual basic y adobe pdf
Publicado por: leliCabello en 3 Diciembre 2010, 02:07 am
qtal amigos espero que me puedan ayudar, este error me salio de un dia para otro, asi, un dia antes de hacerle el ejecutable .exe
lo probe y me funcionaba muy bien, este enviaba correo anexando pdf y texto plano en html, yo seleccionaba al cliente del grid, y llegaba como anexado y en texto plano.
al dia siguiente lo ejecuto y me bota este error y despues envia por ratos y por ratos sale error, no entiendo lo que pasa:
(http://img80.imageshack.us/img80/6590/eliminar2.gif)
y al poner depurar me da resalta esta linea:
(http://img262.imageshack.us/img262/3779/errorh.gif)


Título: Re: Error con con visual basic y adobe pdf
Publicado por: BlackZeroX en 3 Diciembre 2010, 04:06 am
.
No somos adivinos ( No sabemos que haces natesde esa linea ni que se intenta, aun que hay sospechas pero nada concluso ), ya se te a dicho quieres ayuda comparte el pedaso del modulo, igual no sabemos que cosa tiene que cosa...

P.D.: Que feo codigo, se nota que nada esta identado y hay texto por doquier, y el trim esta mal usado con ese string ( No hay que saber mucho para saberlo ), Lectura ilegible y seguro sin procesos ni funciones para identificar lios...

Dulces Lunas!ˇ.


Título: Re: Error con con visual basic y adobe pdf
Publicado por: leliCabello en 3 Diciembre 2010, 23:54 pm
en es el codigo del boton ENVIAR CORREO
Código:
Dim Documento As New Word.Application
    ''''''''''''''''''''''''''''
    email1 = ""
    email2 = ""
    email3 = ""
    If adoConsulta.Recordset.EOF Then
        MsgBox "Seleccione un comprobante para ver"
        Exit Sub
    Else
        tipoComprobante = adoConsulta.Recordset("tipocomprobante")
        cod_comprobante = adoConsulta.Recordset("cod_comprobante")
    End If
    rsClientex.Open "select * from CLIENTES where razon='" & adoConsulta.Recordset("razon") & "'", cn, adOpenStatic, adLockOptimistic
    email1 = IIf(IsNull(rsClientex("correo1")), "", rsClientex("correo1"))
    email2 = IIf(IsNull(rsClientex("correo2")), "", rsClientex("correo2"))
    email3 = IIf(IsNull(rsClientex("correo3")), "", rsClientex("correo3"))
    rsClientex.Close
    Set rsClientex = Nothing
    If email1 <> "" Then
        With Documento
            '.Application.Documents.Open App.Path & "\presupuestos\presupuesto.doc"
            .Application.Documents.Add App.Path & "\plantillahosting\datoshosting.dot"
            .ActiveDocument.Bookmarks.Item("cliente").Range.Text = Trim(adoConsulta.Recordset("razon"))
            .ActiveDocument.Bookmarks.Item("dominio").Range.Text = "www." & Trim(adoConsulta.Recordset("identificador"))
            .ActiveDocument.Bookmarks.Item("cpanel").Range.Text = "http://www." & Trim(adoConsulta.Recordset("identificador")) & "/cpanel"
            .ActiveDocument.Bookmarks.Item("login").Range.Text = Trim(adoConsulta.Recordset("login"))
            .ActiveDocument.Bookmarks.Item("password").Range.Text = Trim(adoConsulta.Recordset("password"))
            .ActiveDocument.Bookmarks.Item("webmail").Range.Text = "http://www." & Trim(adoConsulta.Recordset("identificador")) & "/webmail"
            .ActiveDocument.Bookmarks.Item("ftp").Range.Text = "ftp." & Trim(adoConsulta.Recordset("identificador"))
            .ActiveDocument.Bookmarks.Item("loginftp").Range.Text = Trim(adoConsulta.Recordset("login"))
            .ActiveDocument.Bookmarks.Item("passwordftp").Range.Text = Trim(adoConsulta.Recordset("password"))
            .ActiveDocument.Bookmarks.Item("email").Range.Text = Trim(adoConsulta.Recordset("identificador"))
            .ActiveDocument.Bookmarks.Item("email2").Range.Text = Trim(adoConsulta.Recordset("identificador"))
            .ActiveDocument.Bookmarks.Item("pop3").Range.Text = Trim(adoConsulta.Recordset("identificador"))
            .ActiveDocument.Bookmarks.Item("smtp").Range.Text = Trim(adoConsulta.Recordset("identificador"))
            .ActiveDocument.Bookmarks.Item("vendedor").Range.Text = correousuario
            'muestra el documento
             .ChangeFileOpenDirectory App.Path & "/datosHosting/"
            nomArchivo = "hosting_" & Split(Trim(adoConsulta.Recordset("identificador")), ".")(0)
            archivoCompleto = App.Path & "/datosHosting/" & nomArchivo & ".doc"
            archivoCompletopdf = App.Path & "/datosHosting/" & nomArchivo & ".pdf"
            .ActiveDocument.SaveAs nomArchivo & ".doc", wdFormatDocument, False, "", True, "", False, False, False, False, False
            '.ActivePrinter = "Adobe PDF"
            '.ActivePrinter = "Bullzip PDF Printer"
            .ActivePrinter = "doPDF v7"
            .Application.PrintOut
            .ActiveDocument.Close
        End With
        Documento.Quit
        Set Documento = Nothing
        Timer1.Enabled = True
    Else
        MsgBox "Este cliente no tiene correo por favor ingresar para continuar con el proceso", , "TICOM S.C.R.L."
        Exit Sub
    End If
Y CLARO TENGO MI PLANTILLA WORD EN UNA CARPETA datosHosting. por favor espero q me puedan ayudar por ratos funciona y por ratos me bota error no se a q se debe
y tb tengo el timer su codigo es este
Código:
Private Sub Timer1_Timer()

    If Timer1.Enabled = True Then
        lblAdjunto = archivoCompletopdf
        'ENVIAR CORREOS CON EL MESSAGE MAPI
        'enviar los correos electronicos
        'enviar con send mail
        lstStatus.Clear
        Screen.MousePointer = vbHourglass
        'abrimos la factura
        If rsFactura.State <> 0 Then rsFactura.Close
        rsFactura.Open "select * from vistaFactura where cod_comprobante = " & Val(cod_comprobante) & "", cn, adOpenStatic, adLockOptimistic
       
        '_____________________________________________________
        htmlMensaje = htmlMensaje & "<b><FONT color='red'>Datos del Alojamiento Web</font></b><br><br>"
        htmlMensaje = htmlMensaje & "<table width='700' border='3' cellpadding='1' cellspacing='1' bordercolor='#000000' bgcolor='#0066CC'>"
        htmlMensaje = htmlMensaje & "<tr><td><table width='871' border='1' align='center' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>"
        htmlMensaje = htmlMensaje & "<tr> <td height='113 bgcolor=' bgcolor='#003366'#002E5B'><div align='center'><FONT color='#003399' size='+7'><strong><font color='#FFFFFF'>TICOM</font></strong></FONT><font color='#FFFFFF'><BR />"
         
        htmlMensaje = htmlMensaje & "<FONT color='#F09100' size='2'><strong>SOLUCIONES INFORMATICAS  A NIVEL MUNDIAL</strong></FONT><FONT color='#FFFFFF' size='2'><BR />"
        htmlMensaje = htmlMensaje & "<font face='Verdana, Arial, Helvetica, sans-serif'><strong>Av.</strong> Petit Thouars 1255 Of. 302<br />"
        htmlMensaje = htmlMensaje & "<strong>Telf.:</strong> 2662540 / 7959969 <strong>Cel.</strong> 9-96929470 / 9-91554872</font></FONT></div></td>"
        htmlMensaje = htmlMensaje & "                    "
        htmlMensaje = htmlMensaje & "</tr>"
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & ""
        '
        htmlMensaje = htmlMensaje & "<tr>"
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & "<td valign='top'>"
        htmlMensaje = htmlMensaje & "<table width='864' border='0'>"
        htmlMensaje = htmlMensaje & "<td width='17'>&nbsp;</td>"
        htmlMensaje = htmlMensaje & "<td width='837'><p>Importancia: Alta<br>"
        htmlMensaje = htmlMensaje & "<strong>SE&Ntilde;ORES&nbsp;de&nbsp;</strong><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("razon") & "</font>&nbsp; <br>"
        htmlMensaje = htmlMensaje & "Bienvenidos  al&nbsp;servicio de Hosting&nbsp;con <strong>TICOM</strong> <br>"
       
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
        htmlMensaje = htmlMensaje & "<p>IMPORTANTE: IMPRIMA&nbsp;Y  GUARDE&nbsp;ESTE EMAIL<br>"
       
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>Con esta gu&iacute;a&nbsp;informativa&nbsp;dar&aacute;  los primeros&nbsp;pasos&nbsp;en&nbsp;el servicio de Hosting. El servicio de  hosting&nbsp;funcionar&aacute; pasado&nbsp;24 a 48&nbsp;horas&nbsp;del  cambio&nbsp;de DNS en su dominio. <br>"
         
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>TERMINOS Y CONDICIONES DEL&nbsp;SERVICIO  DE HOSTING<br>"
        htmlMensaje = htmlMensaje & "<p><font color='#FF0000'><strong>No Contenido Adulto</strong></font><br>"
       
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>AGREGUE  SU URL EN EL PORTAL DE TICOM (Gratis)<br>"
        htmlMensaje = htmlMensaje & "<a href='http://www.ticomperu.com/inscribatuempresa.htm'>http://www.ticomperu.com/inscribatuempresa.htm</a><br>"
        htmlMensaje = htmlMensaje & "___________________________________________________________________________</p>"
       
        htmlMensaje = htmlMensaje & "<p>CARACTERISTICAS  GENERALES&nbsp;DEL&nbsp;PLAN CONTRATADO</p>"
       
        htmlMensaje = htmlMensaje & "<p>Dominio Alojado: www.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font> <br>"
        htmlMensaje = htmlMensaje & "Tiempo&nbsp;de contrato:&nbsp; 1 a&ntilde;o <br>"
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>PANEL  DE CONTROL&nbsp;DE HOSTING</p>"
       
        htmlMensaje = htmlMensaje & "<p>Enlace:&nbsp;&nbsp;http://www.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font>/panel&nbsp; <br>"
        htmlMensaje = htmlMensaje & "Usuario:&nbsp;&nbsp;<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("login") & "</font><br>"
        htmlMensaje = htmlMensaje & "Clave:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("password") & "</font></p>"
       
        htmlMensaje = htmlMensaje & "<p>Nota:<br>"
        htmlMensaje = htmlMensaje & "1.-  Cambie&nbsp;la&nbsp;contrase&ntilde;a&nbsp;del panel de control para mayor seguridad<br>"
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>PANEL  DE CREAR EMAILS</p>"
        htmlMensaje = htmlMensaje & "<p>Dentro del panel en la opcion mail<br>"
        htmlMensaje = htmlMensaje & "Luego clic en Add/Remove/Manage Accounts<br>"
        htmlMensaje = htmlMensaje & "Lugo clic en  addcount<br>"
        htmlMensaje = htmlMensaje & "Ingresar el  mail y su password<br>"
        htmlMensaje = htmlMensaje & "Luego hacer  clic en <br>"
       
        htmlMensaje = htmlMensaje & "crear<br>"
        htmlMensaje = htmlMensaje & "_________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>INTERFACE  WEB&nbsp;PARA LEER&nbsp;EMAILS</p>"
       
        htmlMensaje = htmlMensaje & "<p>http://www.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font>/webmail<br>"
       
        htmlMensaje = htmlMensaje & "imp mail client<br>"
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>DATOS&nbsp;DE  CONEXI&Oacute;N PARA UN&nbsp;SOFTWARE</p>"
       
        htmlMensaje = htmlMensaje & "<p>Sitio FTP:&nbsp;&nbsp;ftp.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font><br>"
        htmlMensaje = htmlMensaje & "Usuario:&nbsp;&nbsp;&nbsp;<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("login") & "</font> <br>"
        htmlMensaje = htmlMensaje & "Clave:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("password") & "</font><br>"
        htmlMensaje = htmlMensaje & "__________________________________________________________________________&nbsp;</p>"
       
        htmlMensaje = htmlMensaje & "<p>CONFIGURACION&nbsp;DE CUENTA&nbsp;DE  EMAIL&nbsp;EN OUTLOOK&nbsp;O SIMILARES</p>"
       
        htmlMensaje = htmlMensaje & "<p>1.-&nbsp;Ir a: Herramientas -&gt;  Cuentas... -&gt; Agregar Cuenta de correo</p>"
       
        htmlMensaje = htmlMensaje & "<p>2.-&nbsp;En la  pesta&ntilde;a&nbsp;&quot;General&quot;: <br>"
        htmlMensaje = htmlMensaje & "Direcci&oacute;n de  correo electr&oacute;nico:&nbsp;sucuenta@<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font> <br>"
        htmlMensaje = htmlMensaje & "Activar&nbsp;check&nbsp;&quot;Incluir  la cuenta al recibir correo electr&oacute;nico o sincronizar&quot; </p>"
       
        htmlMensaje = htmlMensaje & "<p>3.-&nbsp;En la pesta&ntilde;a  &quot;Servidores&quot;: <br>"
        htmlMensaje = htmlMensaje & "POP3: mail.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font><br>"
        htmlMensaje = htmlMensaje & "SMTP: mail.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font><br>"
        htmlMensaje = htmlMensaje & "Nombre de  cuenta:&nbsp;sucuenta@<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font> (OjO)&nbsp; <br>"
        htmlMensaje = htmlMensaje & "Clave:&nbsp;suclave <br>"
        htmlMensaje = htmlMensaje & "Active&nbsp;check&nbsp;&quot;Recordar  contrase&ntilde;a&quot; <br>"
        htmlMensaje = htmlMensaje & "Desactive&nbsp;check&nbsp;&quot;Iniciar  sesi&oacute;n usando autenticaci&oacute;n de contrase&ntilde;a segura.&quot; <br>"
        htmlMensaje = htmlMensaje & "Active&nbsp;check&nbsp;&quot;Mi  servidor requiere autenticaci&oacute;n&quot; (OjO)<br>"
        htmlMensaje = htmlMensaje & "  (El bot&oacute;n&nbsp;&quot;configuraci&oacute;n...&quot; se activar&aacute;, click y seleccione) <br>"
        htmlMensaje = htmlMensaje & "  (*) Usar misma configuraci&oacute;n que el servidor de correo entrante.&nbsp; </p>"
       
        htmlMensaje = htmlMensaje & "<p>Nota:&nbsp;Antes debe crear la cuenta  de&nbsp;Email&nbsp;en el&nbsp;panel de control de hosting.<br>"
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
       
        htmlMensaje = htmlMensaje & "<p>SOPORTE  TECNICO ESPA&Ntilde;OL</p>"
       
        htmlMensaje = htmlMensaje & "<p>Email:&nbsp;&nbsp;&nbsp;&nbsp;<a href='mailto:james@ticomperu.com'>informes@ticomperu.com</a> &nbsp;24x7<br>"
        htmlMensaje = htmlMensaje & "Tel&eacute;fono:&nbsp;7959969 &nbsp;Lunes a Viernes -&nbsp;10:00 AM a 6:00 PM. <strong>Cel.</strong> (062)962759419, (62)962928634<br>"
        htmlMensaje = htmlMensaje & "___________________________________________________________________________</p>"
       
        htmlMensaje = htmlMensaje & "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>&quot;Trabajamos para  servirle mejor&quot;</strong></p>"
       
        htmlMensaje = htmlMensaje & "<p>Atte.</p>"
       
        htmlMensaje = htmlMensaje & "<p><font color='#000066'><strong>TICOM SRL</strong></font><br>"
        htmlMensaje = htmlMensaje & " Soluciones  Inform&aacute;ticas a Nivel Mundial<br>"
        htmlMensaje = htmlMensaje & "_____________________________________________________________________</p>"
       
        htmlMensaje = htmlMensaje & "IMPORTANTE: IMPRIMA&nbsp;Y  GUARDE&nbsp;ESTE EMAIL<br>"
        htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p></td>"
        htmlMensaje = htmlMensaje & "</tr>"
        htmlMensaje = htmlMensaje & "</table></td>"
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & "                        "
        htmlMensaje = htmlMensaje & "                        "
        htmlMensaje = htmlMensaje & "</tr>"
        '
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & "<tr>"
        htmlMensaje = htmlMensaje & "<td>&nbsp;</td>"
        htmlMensaje = htmlMensaje & "                    "
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & "</tr>"
        htmlMensaje = htmlMensaje & "<FONT size='1'> </FONT> "
        htmlMensaje = htmlMensaje & ""
        htmlMensaje = htmlMensaje & "</table></td></tr></table>"
   
       '___________________________________________________________________

        With sendmail1
            'Valida (opcional)
            .SMTPHostValidacion = VALIDATE_HOST_NONE
            'Valida la sintaxis de l cuenta (opcional)
            .ValidarEmail = VALIDATE_SYNTAX
            'Opcional
            .Delimitador = ";"
            'Texto  para visualizar en el campo De (opcional)
            .FromDisplayName = " TICOM S.C.R.L. "
            'Requerido (Nombre del servidor SMTP)
            .SMTPHost = "mail.ticomperu.com"
            .Remitente = correousuario
            'Requerido
            .Destinatario = email1
             'Copia normal [CC]
            If email2 <> "" Then
                '.CcDisplayName = email2
                .CcRecipient = email2
            Else
                .CcRecipient = ""
            End If
            'Copia oculta [CCO]
            If email3 <> "" Then
                .BccRecipient = email3
            Else
                .BccRecipient = ""
            End If
            'Asunto del mensaje
            .Asunto = "Datos del Hosting Contratado"
            'Cuerpodel mensaje
            .AsHTML = True
            .Mensaje = htmlMensaje
           
            'Adjunto (opcional)
            .Adjunto = Trim(lblAdjunto)
           
            'Opcional (Prioridad del mensaje)
            .Prioridad = Alta
            'Opcional (si requiere autentificación)
            .UsarLoginSMTP = True
            'Requerido si requiere autentificación
            .Usuario = correousuario
            .Password = passwordusuario
            'txtServer.Text = .SMTPHost
           'Opcional (por defectoutiliza el Tipo MIME)
           .Codificacion = MIME_ENCODE
           
           'Envia el Mail
           .EnviarEmail
       
        End With
        Screen.MousePointer = vbDefault
        ''''''''''''''''''''''''''''''''
        Timer1.Enabled = False
        nomArchivo = ""
        archivoCompleto = ""
        archivoCompletopdf = ""
        lblAdjunto = ""
    End If