Ya sé cómo imprimir archivos!
en un módulo se escribe:
Public Sub PrintTXTFile(FileName As String)
Dim x As Integer
Dim S As String
x = FreeFile
On Error GoTo HandleError
Open FileName For Input As x
Do While Not EOF(x)
Line Input #x, S
Printer.Print S
Loop
Printer.EndDoc
Close #x
Exit Sub
HandleError:
MsgBox "Error :" & Err.Description, vbCritical, "Imprimiendo fichero..."
End Sub
y en un botón de imprimir...
Private Sub Command1_Click()
PrintTXTFile "C:config.sys"
End Sub
también se puede (solo cuando es .txt o .rtf) enlazar el archivo con un un richtextbox y con
Printer.print richtextbox...
Public Sub PrintTXTFile(FileName As String)
Dim x As Integer
Dim S As String
x = FreeFile
On Error GoTo HandleError
Open FileName For Input As x
Do While Not EOF(x)
Line Input #x, S
Printer.Print S
Loop
Printer.EndDoc
Close #x
Exit Sub
HandleError:
MsgBox "Error :" & Err.Description, vbCritical, "Imprimiendo fichero..."
End Sub
y en un botón de imprimir...
Private Sub Command1_Click()
PrintTXTFile "C:config.sys"
End Sub
también se puede (solo cuando es .txt o .rtf) enlazar el archivo con un un richtextbox y con
Printer.print richtextbox...
