• Jueves 2 de Mayo de 2024, 14:01

Autor Tema:  Re: otra fácil: Cómo imprimo?  (Leído 1151 veces)

gabperez

  • Miembro activo
  • **
  • Mensajes: 51
    • Ver Perfil
    • http://www.enlacesjuridicos.com.ar
Re: otra fácil: Cómo imprimo?
« en: Miércoles 17 de Julio de 2002, 13:19 »
0
Perdón la ignorancia. Pero soy nuevo en esto, aunque me fascina. .. La pregunta es qué código básico va en un command button para que me imprima los captions de mis labels, por ejemplo? Gracias otra vez.

cpmario

  • Miembro HIPER activo
  • ****
  • Mensajes: 629
    • Ver Perfil
    • http://www.cpimario.com
Re: otra fácil: Cómo imprimo?
« Respuesta #1 en: Lunes 22 de Julio de 2002, 07:38 »
0
La siguiente rutina hace el trabajo:

Private Sub cmdPrint_Click()
    Dim ctrTemp As Control
    Dim objForm As Form
    Dim intPrintTab As Integer
    On Error GoTo ErrorcmdPrint
    Screen.MousePointer = vbHourglass
    cmdPrint.Enabled = False
    Set objForm = Me
    Printer.Print ""
    Printer.Font = "Times New Roman"
    Printer.FontSize = 12
    Printer.Font.Bold = True
    intPrintTab = 8
    For Each ctrTemp In objForm.Controls
        If TypeOf ctrTemp Is Label Then
            Printer.Print Tab(intPrintTab); ctrTemp.Caption
        End If
    Next ctrTemp
    Printer.EndDoc
    cmdPrint.Enabled = True
    Screen.MousePointer = vbDefault
Exit Sub
ErrorcmdPrint:
    MsgBox "Error al imprimir, revise su impresora." & vbCrLf & Err.Description, vbCritical, "Test"
    cmdPrint.Enabled = True
    Screen.MousePointer = vbDefault
End Sub

quesito

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
    • http://www.solucionescorporativas.net
otra fácil: Cómo imprimo?
« Respuesta #2 en: Jueves 26 de Septiembre de 2002, 23:42 »
0
de donde eres