下面是一段关于打印的代码,但我不知道怎么改了!
例如我要打印C:盘了的一个叫dayin.doc的WORD里的内容.该怎么样去改代码呢!请指教!
  Dim x As Printer
  Dim int1 As Integer
  For Each x In Printers
    int1 = int1 + 1
    If int1 = List1.ListIndex + 1 Then
      Set Printer = x: Exit For
    End If
  Next
  Printer.Print "打印第一页": Printer.NewPage
  Printer.Print "打印第二页": Printer.NewPage
  Printer.Print "打印第三页": Printer.EndDoc
  end sub

解决方案 »

  1.   

    Private Sub命令0_Click()
      Dim WkWord As New Word.Application
      Dim WkDoc  As Word.Document
      Set WkDoc = WkWord.Application.Documents.Open("c:\my documents\文件.doc")
      WkDoc.PrintOut False '在printout后面加上FLASE,會等打完之后再關閉
      WkDoc.Close
      WkWord.Quit
      Set WkDoc = Nothing
    End Sub
      

  2.   


    ‘创建word对象 
    Dim WkWord As New Word.Application
      Dim WkDoc  As Word.Document
      Set WkDoc = WkWord.Application.Documents.Open("c:\my documents\文件.doc")
    ‘打印
    WkDoc.PrintOut False '在printout后面加上FLASE,會等打完之后再關閉
    ‘关闭
      WkDoc.Close
      WkWord.Quit
      Set WkDoc = Nothing具体代码你可以在word录制宏得到
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 最新版本:20070130http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
      

  3.   

    我还想傻傻的问个问题啊!请高手们指教我一下,谢谢了!
    比如说我要打印的是保存在D:盘里的一个stuent的word文档里内容
    但我怎么样在窗体里选择stuent呢???
    代码怎么写啊??