新建一个word文档,在word中插入VB窗体中的list里面的内容,如何实现,谢谢各位高手了

解决方案 »

  1.   

    工程必须引用 Word 类库   ' Declare the variable.
       Dim objWD As Word.Application
       Dim strTemp As String, i As Long   For i = 0 To List1.ListCount
          strTemp = strTemp & List1.List(i) & vbNewLine
       Next i   ' Set the variable (runs new instance of Word.)
       Set objWD = CreateObject("Word.Application")
       ' Add a new document.
       objWD.Documents.Add
       ' Add some text.
       objWD.Selection.TypeText strTemp
       ' Save the document.
       objWD.ActiveDocument.SaveAs filename:="mydoc.doc"
       ' Quit Word.
       objWD.Quit
       ' Clear the variable from memory.
       Set objWD = Nothing
      

  2.   

    我的list列表中有多行,按楼上朋友那样,只能显示最后一行的内容到word中,我希望把list中的所有内容都列到word里面,谢谢了