Printer.Width = 9900‘纸的宽度
        Printer.Height =8505’纸的长度
        Printer.ScaleMode = vbCentimeters
        Printer.Font = "宋体"
        Printer.ScaleTop = 1
        Printer.ScaleLeft = 3
        Printer.FontSize = "11"        Printer.CurrentX = 14‘X轴
        Printer.CurrentY = 1.8’Y轴
        Printer.Print "你要打的内容"
        Printer.EndDoc‘打印结束

解决方案 »

  1.   

    打开一个文件,逐行打
    Open strfile For Input As #1
     Do While Not EOF(1)
     Line Input #1, str
    printer.print str
     Loop
    Close #1
    Printer.EndDoc
      

  2.   

    http://www.csdn.net/expert/topic/858/858297.xml?temp=.7933466
      

  3.   

    http://www.csdn.net/expert/topic/858/858297.xml?temp=.7933466
      

  4.   

    感谢您使用微软产品printer对象没有直接用于打印某个文件的方法,您可以使用API函数CreateFile,ReadFile,WriteFile把文件输出到打印机。如下例,
    Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal _
    lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As _
    Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, _
    ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As LongPrivate Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer _
    As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal _
    lpOverlapped As Long) As LongPrivate Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer _
    As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, _
    ByVal lpOverlapped As Long) As LongPrivate Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As _
    LongPrivate Const GENERIC_WRITE = &H40000000
    Private Const GENERIC_READ = &H80000000
    Private Const OPEN_EXISTING = 3Private Sub Command1_Click()Const INVALID_HANDLE_VALUE = -1Dim BytesToRead As Long
    Dim BytesToWrite As Long
    Dim TotalWritten As Long
    Dim lRead As Long
    Dim lWritten As Long
    Dim fSuccess As Long
    Dim b(1024) As Byte
    Dim hFile As Long
    Dim hPort As Long
    Dim lRet As Long  hFile = CreateFile("E:\temp.txt", _
    GENERIC_READ, 0&, 0&, OPEN_EXISTING, _
    0&, 0&)  If hFile = INVALID_HANDLE_VALUE Then
        MsgBox "Error Opening File"
        Exit Sub
      End If
     
     hPort = CreateFile(Printer.DeviceName, GENERIC_READ Or GENERIC_WRITE, 0&, _
    0&, OPEN_EXISTING, 0&, 0&)  If hPort = INVALID_HANDLE_VALUE Then
         MsgBox "Unable to Open Printer Port"
         fSuccess = CloseHandle(hFile)
         Exit Sub
      End If  lRet = ReadFile(hFile, b(0), UBound(b), lRead, 0)  Do While lRead > 0 And lRet <> 0   lRet = WriteFile(hPort, b(0), lRead, lWritten, 0)   If lRet <> 0 Then
         TotalWritten = TotalWritten + lWritten
         Debug.Print TotalWritten
       End If   lRet = ReadFile(hFile, b(0), UBound(b), lRead, 0)  Loop fSuccess = CloseHandle(hFile)
     fSuccess = CloseHandle(hPort)
           
    End Sub详细信息请参考:
    CreateFile
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/filesio_7wmd.asp
    ReadFile
    http://msdn.microsoft.com/library/en-us/fileio/filesio_39id.asp
    WriteFile
    http://msdn.microsoft.com/library/en-us/fileio/filesio_3kkl.asp- 微软全球技术中心 VB技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款
    (http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
    为了为您创建更好的讨论环境,请参加我们的用户满意度调查
    (http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
      

  5.   

    OrchidPrinter
    http://download.com.com/3000-2401-10126415.html?tag=lst-0-5